From 26c686bcde281ca823245df0942fa5e1daee32af Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 22 Sep 2021 05:26:45 -0700 Subject: [PATCH] Disable process revive and confirmation on web Web always rejects when async code is used --- .../contrib/terminal/browser/terminalService.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts index 2398b4adeba..a90160cf6ba 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts @@ -537,7 +537,17 @@ export class TerminalService implements ITerminalService { return this._defaultProfileName; } - private async _onBeforeShutdown(reason: ShutdownReason): Promise { + private _onBeforeShutdown(reason: ShutdownReason): boolean | Promise { + // Never veto on web as this would block all windows from being closed. This disables + // process revive as we can't handle it on shutdown. + if (isWeb) { + this._isShuttingDown = true; + return false; + } + return this._onBeforeShutdownAsync(reason); + } + + private async _onBeforeShutdownAsync(reason: ShutdownReason): Promise { if (this.instances.length === 0) { // No terminal instances, don't veto return false; @@ -559,7 +569,7 @@ export class TerminalService implements ITerminalService { (this.configHelper.config.confirmOnExit === 'hasChildProcesses' && this.instances.some(e => e.hasChildProcesses)) ); if (hasDirtyInstances) { - return this._onBeforeShutdownAsync(reason); + return this._onBeforeShutdownConfirmation(reason); } } @@ -589,7 +599,7 @@ export class TerminalService implements ITerminalService { } } - private async _onBeforeShutdownAsync(reason: ShutdownReason): Promise { + private async _onBeforeShutdownConfirmation(reason: ShutdownReason): Promise { // veto if configured to show confirmation and the user chose not to exit const veto = await this._showTerminalCloseConfirmation(); if (!veto) {