More verbose conpty, winpty related error message (#294193)

This commit is contained in:
Anthony Kim
2026-02-11 10:27:39 -08:00
committed by GitHub
parent abfdc25d69
commit 04c6ff22be
2 changed files with 11 additions and 1 deletions

View File

@@ -244,7 +244,11 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
return undefined;
} catch (err) {
this._logService.trace('node-pty.node-pty.IPty#spawn native exception', err);
return { message: `A native exception occurred during launch (${err.message})` };
const errorMessage = err.message;
if (errorMessage?.includes('Cannot launch conpty')) {
return { message: localize('conptyLaunchFailed', "A native exception occurred during launch (Cannot launch conpty). Winpty has been removed, see {0} for more details. You can also try enabling the `{1}` setting.", 'https://code.visualstudio.com/updates/v1_109#_removal-of-winpty-support', 'terminal.integrated.windowsUseConptyDll') };
}
return { message: `A native exception occurred during launch (${errorMessage})` };
}
}

View File

@@ -288,6 +288,12 @@ suite('Workbench - TerminalInstance', () => {
{ code: 1260, message: `The terminal process failed to launch: Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open Event Viewer or contact your system Administrator.` }
);
});
test('should format conpty launch failure', () => {
deepStrictEqual(
parseExitResult({ message: 'A native exception occurred during launch (Cannot launch conpty). Winpty has been removed, see https://code.visualstudio.com/updates/v1_109#_removal-of-winpty-support for more details. You can also try enabling the `terminal.integrated.windowsUseConptyDll` setting.' }, {}, ProcessState.KilledDuringLaunch, undefined),
{ code: undefined, message: `The terminal process failed to launch: A native exception occurred during launch (Cannot launch conpty). Winpty has been removed, see https://code.visualstudio.com/updates/v1_109#_removal-of-winpty-support for more details. You can also try enabling the \`terminal.integrated.windowsUseConptyDll\` setting..` }
);
});
test('should format generic failures', () => {
deepStrictEqual(
parseExitResult({ code: 123, message: 'A native exception occurred during launch (Cannot create process, error code: 123)' }, {}, ProcessState.KilledDuringLaunch, undefined),