From df2c34bcc3dace531f26bff96793a5f678effc7b Mon Sep 17 00:00:00 2001 From: anthonykim1 Date: Thu, 12 Mar 2026 22:34:37 -0700 Subject: [PATCH 1/4] Update conpty to 1.25 --- package-lock.json | 8 ++++---- package.json | 2 +- remote/package-lock.json | 8 ++++---- remote/package.json | 2 +- .../contrib/terminal/common/terminalConfiguration.ts | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7c4cf21ecb431..a4a13bdb5f8bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "minimist": "^1.2.8", "native-is-elevated": "0.9.0", "native-keymap": "^3.3.5", - "node-pty": "^1.2.0-beta.10", + "node-pty": "^1.2.0-beta.12", "open": "^10.1.2", "playwright-core": "1.59.0-alpha-2026-02-20", "tas-client": "0.3.1", @@ -15274,9 +15274,9 @@ } }, "node_modules/node-pty": { - "version": "1.2.0-beta.10", - "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.2.0-beta.10.tgz", - "integrity": "sha512-vONwSCtAiOVNxeaP/lzDdRw733Q6uB/ELOCFM8DUfKMw6rTFovwFCuvqr9usya7JXV2pfaers3EwuzZfv0QtwA==", + "version": "1.2.0-beta.12", + "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.2.0-beta.12.tgz", + "integrity": "sha512-uExTCG/4VmSJa4+TjxFwPXv8BfacmfFEBL6JpxCMDghcwqzvD0yTcGmZ1fKOK6HY33tp0CelLblqTECJizc+Yw==", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index d4c5f5c70964b..f61906b3ea4e3 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "minimist": "^1.2.8", "native-is-elevated": "0.9.0", "native-keymap": "^3.3.5", - "node-pty": "^1.2.0-beta.10", + "node-pty": "^1.2.0-beta.12", "open": "^10.1.2", "playwright-core": "1.59.0-alpha-2026-02-20", "tas-client": "0.3.1", diff --git a/remote/package-lock.json b/remote/package-lock.json index fd94c9d768c87..042663cb50446 100644 --- a/remote/package-lock.json +++ b/remote/package-lock.json @@ -39,7 +39,7 @@ "katex": "^0.16.22", "kerberos": "2.1.1", "minimist": "^1.2.8", - "node-pty": "^1.2.0-beta.10", + "node-pty": "^1.2.0-beta.12", "tas-client": "0.3.1", "vscode-oniguruma": "1.7.0", "vscode-regexpp": "^3.1.0", @@ -1112,9 +1112,9 @@ } }, "node_modules/node-pty": { - "version": "1.2.0-beta.10", - "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.2.0-beta.10.tgz", - "integrity": "sha512-vONwSCtAiOVNxeaP/lzDdRw733Q6uB/ELOCFM8DUfKMw6rTFovwFCuvqr9usya7JXV2pfaers3EwuzZfv0QtwA==", + "version": "1.2.0-beta.12", + "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.2.0-beta.12.tgz", + "integrity": "sha512-uExTCG/4VmSJa4+TjxFwPXv8BfacmfFEBL6JpxCMDghcwqzvD0yTcGmZ1fKOK6HY33tp0CelLblqTECJizc+Yw==", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/remote/package.json b/remote/package.json index ec73a84fff08b..1b602b7f96ffd 100644 --- a/remote/package.json +++ b/remote/package.json @@ -34,7 +34,7 @@ "katex": "^0.16.22", "kerberos": "2.1.1", "minimist": "^1.2.8", - "node-pty": "^1.2.0-beta.10", + "node-pty": "^1.2.0-beta.12", "tas-client": "0.3.1", "vscode-oniguruma": "1.7.0", "vscode-regexpp": "^3.1.0", diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 132db6d298270..ab230b025f66d 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -476,7 +476,7 @@ const terminalConfiguration: IStringDictionary = { }, [TerminalSettingId.WindowsUseConptyDll]: { restricted: true, - markdownDescription: localize('terminal.integrated.windowsUseConptyDll', "Whether to use the experimental conpty.dll (v1.23.251008001) shipped with VS Code, instead of the one bundled with Windows."), + markdownDescription: localize('terminal.integrated.windowsUseConptyDll', "Whether to use the experimental conpty.dll (v1.25.260303002) shipped with VS Code, instead of the one bundled with Windows."), type: 'boolean', tags: ['preview'], default: false, From c5d9064efaeb53b7adfa2270e964b7726b229e42 Mon Sep 17 00:00:00 2001 From: anthonykim1 Date: Thu, 12 Mar 2026 23:08:23 -0700 Subject: [PATCH 2/4] see if changes fix 1.2.0-beta11 defering conptyNative.connect() --- .../platform/terminal/node/childProcessMonitor.ts | 10 +++++++++- src/vs/platform/terminal/node/terminalProcess.ts | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/terminal/node/childProcessMonitor.ts b/src/vs/platform/terminal/node/childProcessMonitor.ts index 40ac2d2305071..2b9bdfb2e5b2d 100644 --- a/src/vs/platform/terminal/node/childProcessMonitor.ts +++ b/src/vs/platform/terminal/node/childProcessMonitor.ts @@ -49,12 +49,20 @@ export class ChildProcessMonitor extends Disposable { readonly onDidChangeHasChildProcesses = this._onDidChangeHasChildProcesses.event; constructor( - private readonly _pid: number, + private _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. */ diff --git a/src/vs/platform/terminal/node/terminalProcess.ts b/src/vs/platform/terminal/node/terminalProcess.ts index 60563ff6487a8..e9f3a01b4f934 100644 --- a/src/vs/platform/terminal/node/terminalProcess.ts +++ b/src/vs/platform/terminal/node/terminalProcess.ts @@ -337,7 +337,20 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess this._exitCode = e.exitCode; this._queueProcessExit(); })); - this._sendProcessId(ptyProcess.pid); + // 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._setupTitlePolling(ptyProcess); } From ded49adb1462236bfafa8bfc18f23abe0e475f5c Mon Sep 17 00:00:00 2001 From: anthonykim1 Date: Fri, 13 Mar 2026 09:02:43 -0700 Subject: [PATCH 3/4] Revert "see if changes fix 1.2.0-beta11 defering conptyNative.connect()" This reverts commit c5d9064efaeb53b7adfa2270e964b7726b229e42. --- .../platform/terminal/node/childProcessMonitor.ts | 10 +--------- src/vs/platform/terminal/node/terminalProcess.ts | 15 +-------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/vs/platform/terminal/node/childProcessMonitor.ts b/src/vs/platform/terminal/node/childProcessMonitor.ts index 2b9bdfb2e5b2d..40ac2d2305071 100644 --- a/src/vs/platform/terminal/node/childProcessMonitor.ts +++ b/src/vs/platform/terminal/node/childProcessMonitor.ts @@ -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. */ diff --git a/src/vs/platform/terminal/node/terminalProcess.ts b/src/vs/platform/terminal/node/terminalProcess.ts index e9f3a01b4f934..60563ff6487a8 100644 --- a/src/vs/platform/terminal/node/terminalProcess.ts +++ b/src/vs/platform/terminal/node/terminalProcess.ts @@ -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); } From 27f480542e4142013bb2c9a8281cd6d0f5e6e3dc Mon Sep 17 00:00:00 2001 From: anthonykim1 Date: Fri, 13 Mar 2026 09:34:13 -0700 Subject: [PATCH 4/4] Reapply "see if changes fix 1.2.0-beta11 defering conptyNative.connect()" This reverts commit ded49adb1462236bfafa8bfc18f23abe0e475f5c. --- .../platform/terminal/node/childProcessMonitor.ts | 10 +++++++++- src/vs/platform/terminal/node/terminalProcess.ts | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/terminal/node/childProcessMonitor.ts b/src/vs/platform/terminal/node/childProcessMonitor.ts index 40ac2d2305071..2b9bdfb2e5b2d 100644 --- a/src/vs/platform/terminal/node/childProcessMonitor.ts +++ b/src/vs/platform/terminal/node/childProcessMonitor.ts @@ -49,12 +49,20 @@ export class ChildProcessMonitor extends Disposable { readonly onDidChangeHasChildProcesses = this._onDidChangeHasChildProcesses.event; constructor( - private readonly _pid: number, + private _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. */ diff --git a/src/vs/platform/terminal/node/terminalProcess.ts b/src/vs/platform/terminal/node/terminalProcess.ts index 60563ff6487a8..e9f3a01b4f934 100644 --- a/src/vs/platform/terminal/node/terminalProcess.ts +++ b/src/vs/platform/terminal/node/terminalProcess.ts @@ -337,7 +337,20 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess this._exitCode = e.exitCode; this._queueProcessExit(); })); - this._sendProcessId(ptyProcess.pid); + // 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._setupTitlePolling(ptyProcess); }