Revert "see if changes fix 1.2.0-beta11 defering conptyNative.connect()"

This reverts commit c5d9064efa.
This commit is contained in:
anthonykim1
2026-03-13 09:02:43 -07:00
parent c5d9064efa
commit ded49adb14
2 changed files with 2 additions and 23 deletions

View File

@@ -49,20 +49,12 @@ export class ChildProcessMonitor extends Disposable {
readonly onDidChangeHasChildProcesses = this._onDidChangeHasChildProcesses.event;
constructor(
private _pid: number,
private readonly _pid: number,
@ILogService private readonly _logService: ILogService
) {
super();
}
/**
* Updates the pid to monitor. This is needed when the pid is not available
* immediately after spawn (e.g. node-pty deferred conpty connection).
*/
setPid(pid: number): void {
this._pid = pid;
}
/**
* Input was triggered on the process.
*/

View File

@@ -337,20 +337,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
this._exitCode = e.exitCode;
this._queueProcessExit();
}));
// node-pty >= 1.2.0-beta.11 defers conptyNative.connect() on Windows, so
// ptyProcess.pid may be 0 immediately after spawn. In that case we wait
// for the first data event which only fires after the connection completes
// and the real pid is available. See microsoft/node-pty#885.
if (ptyProcess.pid > 0) {
this._sendProcessId(ptyProcess.pid);
} else {
const dataListener = ptyProcess.onData(() => {
dataListener.dispose();
this._childProcessMonitor?.setPid(ptyProcess.pid);
this._sendProcessId(ptyProcess.pid);
});
this._register(dataListener);
}
this._sendProcessId(ptyProcess.pid);
this._setupTitlePolling(ptyProcess);
}