Skip to content

Commit accd0fb

Browse files
single mode file f5 (#8927)
1 parent d0d269b commit accd0fb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Extension/src/LanguageServer/cppBuildTaskProvider.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as path from 'path';
77
import {
88
TaskDefinition, Task, TaskGroup, ShellExecution, workspace,
9-
TaskProvider, TaskScope, CustomExecution, ProcessExecution, TextEditor, Pseudoterminal, EventEmitter, Event, TerminalDimensions, window, WorkspaceFolder, tasks
9+
TaskProvider, TaskScope, CustomExecution, ProcessExecution, TextEditor, Pseudoterminal, EventEmitter, Event, TerminalDimensions, window, WorkspaceFolder, tasks, TaskExecution, TaskEndEvent, Disposable
1010
} from 'vscode';
1111
import * as os from 'os';
1212
import * as util from '../common';
@@ -300,12 +300,19 @@ export class CppBuildTaskProvider implements TaskProvider {
300300
} else {
301301
const resolvedTask: CppBuildTask | undefined = this.resolveInsiderTask(task);
302302
if (resolvedTask) {
303-
await tasks.executeTask(resolvedTask);
303+
const execution: TaskExecution = await tasks.executeTask(resolvedTask);
304+
return new Promise<void>((resolve) => {
305+
const disposable: Disposable = tasks.onDidEndTask((endEvent: TaskEndEvent) => {
306+
if (endEvent.execution.task.group === TaskGroup.Build && endEvent.execution === execution) {
307+
disposable.dispose();
308+
resolve();
309+
}
310+
});
311+
});
304312
} else {
305313
throw new Error("Failed to run resolved task in runBuildTask()");
306314
}
307315
}
308-
309316
}
310317

311318
public async checkDebugConfigExists(configName: string): Promise<void> {

0 commit comments

Comments
 (0)