Skip to content

Commit 1cd90cc

Browse files
authored
make sure execute in terminal is reached (microsoft#155254)
1 parent 394eaa9 commit 1cd90cc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
192192
private _terminals: IStringDictionary<ITerminalData>;
193193
private _idleTaskTerminals: LinkedMap<string, string>;
194194
private _sameTaskTerminals: IStringDictionary<string>;
195+
private _terminalForTask: ITerminalInstance | undefined;
195196
private _taskSystemInfoResolver: ITaskSystemInfoResolver;
196197
private _lastTask: VerifiedTask | undefined;
197198
// Should always be set in run
@@ -282,8 +283,8 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
282283
this._reconnectToTerminals(terminals);
283284
}
284285
if (this._tasksToReconnect.includes(task._id)) {
285-
this._lastTask = new VerifiedTask(task, resolver, trigger);
286-
this.rerun();
286+
this._terminalForTask = terminals.find(t => t.shellLaunchConfig.attachPersistentProcess?.task?.id === task._id);
287+
this.run(task, resolver, trigger);
287288
}
288289
return undefined;
289290
}
@@ -305,7 +306,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
305306
}
306307

307308
try {
308-
const executeResult = { kind: TaskExecuteKind.Started, task, started: {}, promise: this._executeTask(task, resolver, trigger, new Set()) };
309+
const executeResult = { kind: TaskExecuteKind.Started, task, started: {}, promise: this._executeTask(task, resolver, trigger, new Set(), undefined) };
309310
executeResult.promise.then(summary => {
310311
this._lastTask = this._currentTask;
311312
});
@@ -880,7 +881,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
880881
}));
881882
watchingProblemMatcher.aboutToStart();
882883
let delayer: Async.Delayer<any> | undefined = undefined;
883-
[terminal, error] = await this._createTerminal(task, resolver, workspaceFolder);
884+
[terminal, error] = this._terminalForTask ? [this._terminalForTask, undefined] : await this._createTerminal(task, resolver, workspaceFolder);
884885

885886
if (error) {
886887
return Promise.reject(new Error((<TaskError>error).message));
@@ -962,7 +963,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
962963
});
963964
});
964965
} else {
965-
[terminal, error] = await this._createTerminal(task, resolver, workspaceFolder);
966+
[terminal, error] = this._terminalForTask ? [this._terminalForTask, undefined] : await this._createTerminal(task, resolver, workspaceFolder);
966967

967968
if (error) {
968969
return Promise.reject(new Error((<TaskError>error).message));

0 commit comments

Comments
 (0)