insert a 1 sec delay before using a newly created integr. terminal; a companion fix for #38578

This commit is contained in:
Andre Weinand
2020-11-11 22:18:31 +01:00
parent 56947b3a75
commit bd98013973

View File

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