diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 0ea4dd2faec3ce..5ec644c6ad6533 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -524,11 +524,6 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } private _executeTask(task: Task, resolver: ITaskResolver, trigger: string, encounteredDependencies: Set, alreadyResolved?: Map): Promise { - if (encounteredDependencies.has(task.getCommonTaskId())) { - this._showDependencyCycleMessage(task); - return Promise.resolve({}); - } - this._showTaskLoadErrors(task); const mapKey = task.getMapKey(); @@ -540,15 +535,21 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { alreadyResolved = alreadyResolved ?? new Map(); const promises: Promise[] = []; if (task.configurationProperties.dependsOn) { + encounteredDependencies.add(task.getCommonTaskId()); for (const dependency of task.configurationProperties.dependsOn) { const dependencyTask = await resolver.resolve(dependency.uri, dependency.task!); if (dependencyTask) { this._adoptConfigurationForDependencyTask(dependencyTask, task); const key = dependencyTask.getMapKey(); - let promise = this._activeTasks[key] ? this._getDependencyPromise(this._activeTasks[key]) : undefined; + let promise; + if (encounteredDependencies.has(dependencyTask.getCommonTaskId())) { + this._showDependencyCycleMessage(dependencyTask); + promise = Promise.resolve({}); + } else { + promise = this._activeTasks[key] ? this._getDependencyPromise(this._activeTasks[key]) : undefined; + } if (!promise) { this._fireTaskEvent(TaskEvent.create(TaskEventKind.DependsOnStarted, task)); - encounteredDependencies.add(task.getCommonTaskId()); promise = this._executeDependencyTask(dependencyTask, resolver, trigger, encounteredDependencies, alreadyResolved); } promises.push(promise);