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); } } +