From bd98013973a8a52bea8fbf187fffaf45fc50a23c Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Wed, 11 Nov 2020 22:18:31 +0100 Subject: [PATCH] insert a 1 sec delay before using a newly created integr. terminal; a companion fix for #38578 --- src/vs/workbench/api/node/extHostDebugService.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index 273990e3f43..9bb1c5f3653 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -89,6 +89,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase { const configProvider = await this._configurationService.getConfigProvider(); const shell = this._terminalService.getDefaultShell(true, configProvider); let cwdForPrepareCommand: string | undefined; + let giveShellTimeToInitialize = false; if (needNewTerminal || !this._integratedTerminalInstance) { @@ -98,7 +99,9 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase { cwd: args.cwd, name: args.title || nls.localize('debug.terminal.title', "debuggee"), }; + giveShellTimeToInitialize = true; this._integratedTerminalInstance = this._terminalService.createTerminalFromOptions(options, true); + } else { cwdForPrepareCommand = args.cwd; } @@ -108,6 +111,12 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase { terminal.show(); const shellProcessId = await this._integratedTerminalInstance.processId; + + if (giveShellTimeToInitialize) { + // give a new terminal some time to initialize the shell + await new Promise(resolve => setTimeout(resolve, 1000)); + } + const command = prepareCommand(shell, args.args, cwdForPrepareCommand, args.env); terminal.sendText(command, true); @@ -124,3 +133,4 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase { return new ExtHostVariableResolverService(folders, editorService, configurationService, process.env as env.IProcessEnvironment); } } +