This commit is contained in:
isidor
2019-12-24 11:35:29 +01:00
parent a1875d15c8
commit 7531960f4e
2 changed files with 11 additions and 1 deletions
@@ -675,13 +675,13 @@ export class DebugService implements IDebugService {
}
stopSession(session: IDebugSession): Promise<any> {
if (session) {
return session.terminate();
}
const sessions = this.model.getSessions();
if (sessions.length === 0) {
this.taskRunner.cancel();
this.endInitializingState();
}
@@ -38,6 +38,8 @@ export const enum TaskRunResult {
export class DebugTaskRunner {
private canceled = false;
constructor(
@ITaskService private readonly taskService: ITaskService,
@IMarkerService private readonly markerService: IMarkerService,
@@ -46,9 +48,17 @@ export class DebugTaskRunner {
@IDialogService private readonly dialogService: IDialogService,
) { }
cancel(): void {
this.canceled = true;
}
async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | TaskIdentifier | undefined, onError: (msg: string, actions: IAction[]) => Promise<void>): Promise<TaskRunResult> {
try {
this.canceled = false;
const taskSummary = await this.runTask(root, taskId);
if (this.canceled) {
return TaskRunResult.Failure;
}
const errorCount = taskId ? this.markerService.getStatistics().errors : 0;
const successExitCode = taskSummary && taskSummary.exitCode === 0;