Skip to content

Commit 6f941c3

Browse files
authored
Differentiate between regular termination and cancellation (#3446)
1 parent 13bb8b0 commit 6f941c3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

vscode/src/streamingRunner.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class StreamingRunner implements vscode.Disposable {
8585
linkedCancellationSource.onCancellationRequested(async () => {
8686
this.run!.appendOutput("\r\nTest run cancelled.");
8787
abortController.abort();
88-
await this.finalize();
88+
await this.finalize(true);
8989
});
9090

9191
if (mode === Mode.Run) {
@@ -248,8 +248,8 @@ export class StreamingRunner implements vscode.Disposable {
248248
return server;
249249
}
250250

251-
private async finalize() {
252-
if (this.currentWorkspace) {
251+
private async finalize(cancellation: boolean) {
252+
if (cancellation && this.currentWorkspace) {
253253
// If the tests are being executed in a terminal, send a CTRL+C signal to stop them
254254
const terminal = this.terminals.get(
255255
`${this.currentWorkspace.workspaceFolder.name}: test`,
@@ -294,9 +294,8 @@ export class StreamingRunner implements vscode.Disposable {
294294

295295
// Handle the JSON events being emitted by the tests
296296
this.disposables.push(
297-
this.connection.onNotification(
298-
NOTIFICATION_TYPES.finish,
299-
this.finalize.bind(this),
297+
this.connection.onNotification(NOTIFICATION_TYPES.finish, () =>
298+
this.finalize(false),
300299
),
301300
);
302301

0 commit comments

Comments
 (0)