Skip to content

Commit

Permalink
update inProgressTasks in executeTask (#169044)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Dec 13, 2022
1 parent 7dcd27a commit baea24b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,11 +1205,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
if (!task) {
throw new TaskError(Severity.Info, nls.localize('TaskServer.noTask', 'Task to execute is undefined'), TaskErrors.TaskNotFound);
}
if (this._inProgressTasks.has(task._label)) {
this._logService.info('Prevented duplicate task from running', task._label);
return;
}
this._inProgressTasks.add(task._label);
const resolver = this._createResolver();
let executeTaskResult: ITaskSummary | undefined;
try {
Expand All @@ -1225,8 +1220,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
} catch (error) {
this._handleError(error);
return Promise.reject(error);
} finally {
this._inProgressTasks.delete(task._label);
}
}

Expand Down Expand Up @@ -1837,7 +1830,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
}

private async _executeTask(task: Task, resolver: ITaskResolver, runSource: TaskRunSource): Promise<ITaskSummary> {
if (this._inProgressTasks.has(task._label)) {
this._logService.info('Prevented duplicate task from running', task._label);
return { exitCode: 0 };
}
let taskToRun: Task = task;
this._inProgressTasks.add(task._label);
if (await this._saveBeforeRun()) {
await this._configurationService.reloadConfiguration();
await this._updateWorkspaceTasks();
Expand All @@ -1852,8 +1850,10 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
await ProblemMatcherRegistry.onReady();
const executeResult = runSource === TaskRunSource.Reconnect ? this._getTaskSystem().reconnect(taskToRun, resolver) : this._getTaskSystem().run(taskToRun, resolver);
if (executeResult) {
this._inProgressTasks.delete(task._label);
return this._handleExecuteResult(executeResult, runSource);
}
this._inProgressTasks.delete(task._label);
return { exitCode: 0 };
}

Expand Down

0 comments on commit baea24b

Please sign in to comment.