Skip to content

Commit

Permalink
fix: only listen for main debug run
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt committed Sep 27, 2024
1 parent 11ffcc9 commit a69353a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,16 @@ export class Extension implements RunHooks {
if (mode === 'debug') {
const debugEnd = new this._vscode.CancellationTokenSource();
testRun.token.onCancellationRequested(() => debugEnd.cancel());
this._vscode.debug.onDidTerminateDebugSession(() => debugEnd.cancel());

let mainDebugRun: vscodeTypes.DebugSession | undefined;
this._vscode.debug.onDidStartDebugSession(session => { mainDebugRun ??= session; });
this._vscode.debug.onDidTerminateDebugSession(session => {
// child processes have their own debug sessions,
// but we only want to stop debugging if the user cancels the main session
if (session.id === mainDebugRun?.id)
debugEnd.cancel();
});

await model.debugTests(items, testListener, debugEnd.token);
} else {
// Force trace viewer update to surface check version errors.
Expand Down

0 comments on commit a69353a

Please sign in to comment.