From 51acdefbaf102ed6d4b377b404c7bf53d83f9e15 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:04:28 -0700 Subject: [PATCH 1/2] Fix incorrect relaunch when exit code is 0 Part of #154421 --- src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 402e8cf18e8e7..881f374336bd1 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -1657,7 +1657,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { const parsedExitResult = parseExitResult(exitCodeOrError, this.shellLaunchConfig, this._processManager.processState, this._initialCwd); - if (this._usedShellIntegrationInjection && (this._processManager.processState === ProcessState.KilledDuringLaunch || this._processManager.processState === ProcessState.KilledByProcess)) { + if (this._usedShellIntegrationInjection && (this._processManager.processState === ProcessState.KilledDuringLaunch || this._processManager.processState === ProcessState.KilledByProcess) && parsedExitResult?.code !== 0) { this._relaunchWithShellIntegrationDisabled(parsedExitResult?.message); this._onExit.fire(exitCodeOrError); return; From 9d4d0c2d63249b49ba8973498fce4001864acfc4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:06:26 -0700 Subject: [PATCH 2/2] Don't relaunch shell integration terminals when killed by process The failures we care about should be covered by KilledDuringLaunch Fixes #154421 --- src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 881f374336bd1..684234f91e76e 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -1657,7 +1657,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { const parsedExitResult = parseExitResult(exitCodeOrError, this.shellLaunchConfig, this._processManager.processState, this._initialCwd); - if (this._usedShellIntegrationInjection && (this._processManager.processState === ProcessState.KilledDuringLaunch || this._processManager.processState === ProcessState.KilledByProcess) && parsedExitResult?.code !== 0) { + if (this._usedShellIntegrationInjection && this._processManager.processState === ProcessState.KilledDuringLaunch && parsedExitResult?.code !== 0) { this._relaunchWithShellIntegrationDisabled(parsedExitResult?.message); this._onExit.fire(exitCodeOrError); return;