Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/editors/vscode/src/test-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ class DebugRunFlow {
this.onFirstAttach = resolve;
});
private announcements: Promise<void> = Promise.resolve();
/** The run's terminal window, when the gesture opened one. */
private window: vscode.Terminal | undefined;
private finished = false;
private readonly watcher = new TestHostWatcher((pid) => {
this.queueHost(pid);
Expand Down Expand Up @@ -236,7 +238,15 @@ class DebugRunFlow {
const bridge = token.onCancellationRequested(() => {
this.stop.abort();
});
vscode.window.createTerminal({ name: TEST_DEBUG_TERMINAL_NAME, pty: this.terminal }).show(true);
// An already-cancelled gesture runs nothing worth showing: opening a
// terminal for it only leaves a ghost beside the next run.
if (!this.stop.signal.aborted) {
this.window = vscode.window.createTerminal({
name: TEST_DEBUG_TERMINAL_NAME,
pty: this.terminal,
});
this.window.show(true);
}
try {
await Promise.race([this.attached, this.settle()]);
} finally {
Expand All @@ -261,6 +271,9 @@ class DebugRunFlow {
this.endedWaiters.clear();
this.run.end();
this.terminal.end();
// The pty's close only reaches a terminal VS Code has opened; disposing
// the window itself closes one it never opened, too.
this.window?.dispose();
}
}

Expand Down
Loading