@@ -192,6 +192,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
192
192
private _terminals : IStringDictionary < ITerminalData > ;
193
193
private _idleTaskTerminals : LinkedMap < string , string > ;
194
194
private _sameTaskTerminals : IStringDictionary < string > ;
195
+ private _terminalForTask : ITerminalInstance | undefined ;
195
196
private _taskSystemInfoResolver : ITaskSystemInfoResolver ;
196
197
private _lastTask : VerifiedTask | undefined ;
197
198
// Should always be set in run
@@ -282,8 +283,8 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
282
283
this . _reconnectToTerminals ( terminals ) ;
283
284
}
284
285
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 ) ;
287
288
}
288
289
return undefined ;
289
290
}
@@ -305,7 +306,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
305
306
}
306
307
307
308
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 ) } ;
309
310
executeResult . promise . then ( summary => {
310
311
this . _lastTask = this . _currentTask ;
311
312
} ) ;
@@ -880,7 +881,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
880
881
} ) ) ;
881
882
watchingProblemMatcher . aboutToStart ( ) ;
882
883
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 ) ;
884
885
885
886
if ( error ) {
886
887
return Promise . reject ( new Error ( ( < TaskError > error ) . message ) ) ;
@@ -962,7 +963,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
962
963
} ) ;
963
964
} ) ;
964
965
} else {
965
- [ terminal , error ] = await this . _createTerminal ( task , resolver , workspaceFolder ) ;
966
+ [ terminal , error ] = this . _terminalForTask ? [ this . _terminalForTask , undefined ] : await this . _createTerminal ( task , resolver , workspaceFolder ) ;
966
967
967
968
if ( error ) {
968
969
return Promise . reject ( new Error ( ( < TaskError > error ) . message ) ) ;
0 commit comments