diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index 193490ea7b0..9748e2fd654 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -84,8 +84,10 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase { const shell = this._terminalService.getDefaultShell(true); const shellArgs = this._terminalService.getDefaultShellArgs(true); + const terminalName = args.title || nls.localize('debug.terminal.title', "Debug Process"); + const shellConfig = JSON.stringify({ shell, shellArgs }); - let terminal = await this._integratedTerminalInstances.checkout(shellConfig); + let terminal = await this._integratedTerminalInstances.checkout(shellConfig, terminalName); let cwdForPrepareCommand: string | undefined; let giveShellTimeToInitialize = false; @@ -95,7 +97,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase { shellPath: shell, shellArgs: shellArgs, cwd: args.cwd, - name: args.title || nls.localize('debug.terminal.title', "debuggee"), + name: terminalName, }; giveShellTimeToInitialize = true; terminal = this._terminalService.createTerminalFromOptions(options, { @@ -162,9 +164,15 @@ class DebugTerminalCollection { private _terminalInstances = new Map(); - public async checkout(config: string) { + public async checkout(config: string, name: string) { const entries = [...this._terminalInstances.entries()]; const promises = entries.map(([terminal, termInfo]) => createCancelablePromise(async ct => { + + // Only allow terminals that match the title. See #123189 + if (terminal.name !== name) { + return null; + } + if (termInfo.lastUsedAt !== -1 && await hasChildProcesses(await terminal.processId)) { return null; }