Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show better messages for windows error codes #135483

Merged
merged 2 commits into from Oct 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Expand Up @@ -1376,8 +1376,17 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
break;
}
this._exitCode = exitCodeOrError.code;
if (exitCodeOrError.message.match(/.*error code:\s*\d{3}.*$/)) {
exitCodeOrError.message = `Invalid starting directory ${this.initialCwd}, review your terminal.integrated.cwd setting.`;
const conptyError = exitCodeOrError.message.match(/.*error code:\s*(\d{3,4}).*$/);
if (conptyError) {
const errorCode = conptyError.length > 1 ? parseInt(conptyError[1]) : undefined;
switch (errorCode) {
case 267:
exitCodeOrError.message = `Invalid starting directory ${this.initialCwd}, review your terminal.integrated.cwd setting`;
break;
case 1260:
exitCodeOrError.message = `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`;
break;
}
}
exitCodeMessage = nls.localize('launchFailed.errorMessage', "The terminal process failed to launch: {0}.", exitCodeOrError.message);
break;
Expand Down