Skip to content

Commit

Permalink
wip #203776
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Jul 31, 2024
1 parent 284a605 commit 63b016b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
const nextLiveDependencies = new Set(liveDependencies).add(task.getCommonTaskId());
for (const dependency of task.configurationProperties.dependsOn) {
const dependencyTask = await resolver.resolve(dependency.uri, dependency.task);
this._log('dependency task ' + dependencyTask?._label);
if (dependencyTask) {
this._adoptConfigurationForDependencyTask(dependencyTask, task);
let taskResult;
Expand All @@ -521,17 +522,24 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
if (!taskResult) {
const activeTask = this._activeTasks[dependencyTask.getMapKey()] ?? this._getInstances(dependencyTask).pop();
taskResult = activeTask && this._getDependencyPromise(activeTask);
if (activeTask) {
// If the task is already running, terminate it
this._log('terminating already active task ' + activeTask.task._label);
this.terminate(activeTask.task);
this._removeFromActiveTasks(activeTask.task);
}
}
}
if (!taskResult) {
this._fireTaskEvent(TaskEvent.general(TaskEventKind.DependsOnStarted, task));
taskResult = this._executeDependencyTask(dependencyTask, resolver, trigger, nextLiveDependencies, encounteredTasks, alreadyResolved);
}
this._log('depends on started ' + task._label);
this._fireTaskEvent(TaskEvent.general(TaskEventKind.DependsOnStarted, task));
taskResult = this._executeDependencyTask(dependencyTask, resolver, trigger, nextLiveDependencies, encounteredTasks, alreadyResolved);
this._log('encounteredTasks set ' + commonKey);
encounteredTasks.set(commonKey, taskResult);
promises.push(taskResult);
if (task.configurationProperties.dependsOrder === DependsOrder.sequence) {
const promiseResult = await taskResult;
if (promiseResult.exitCode !== 0) {
this._log('value of promiseResult.exitCode ' + promiseResult.exitCode);
break;
}
}
Expand Down Expand Up @@ -570,6 +578,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
const count = lastInstance?.count ?? { count: 0 };
count.count++;
const activeTask = { task, promise, count };
this._log('setting active task ' + activeTask.task._label);
this._activeTasks[mapKey] = activeTask;
return promise;
}
Expand Down

0 comments on commit 63b016b

Please sign in to comment.