diff --git a/package-lock.json b/package-lock.json index a5e0ceae70c..69fb02e0fa5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,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", @@ -15517,9 +15517,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 4758b5a295c..e661637f12e 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,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 fd94c9d768c..042663cb504 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 ec73a84fff0..1b602b7f96f 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/platform/terminal/node/childProcessMonitor.ts b/src/vs/platform/terminal/node/childProcessMonitor.ts index 40ac2d23050..2b9bdfb2e5b 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 60563ff6487..e9f3a01b4f9 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); } diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 132db6d2982..ab230b025f6 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,