@@ -1277,8 +1277,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
1277
1277
}
1278
1278
for ( let i = 0 ; i < this . _reconnectedTerminals . length ; i ++ ) {
1279
1279
const terminal = this . _reconnectedTerminals [ i ] ;
1280
- const data = terminal . shellLaunchConfig . attachPersistentProcess ?. reconnectionProperties ?. data as IReconnectionTaskData | undefined ;
1281
- if ( data ?. lastTask === task . getCommonTaskId ( ) ) {
1280
+ if ( getReconnectionData ( terminal ) ?. lastTask === task . getCommonTaskId ( ) ) {
1282
1281
this . _reconnectedTerminals . splice ( i , 1 ) ;
1283
1282
return terminal ;
1284
1283
}
@@ -1323,16 +1322,17 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
1323
1322
this . _logService . trace ( `Already reconnected, to ${ this . _reconnectedTerminals ?. length } terminals so returning` ) ;
1324
1323
return ;
1325
1324
}
1326
- this . _reconnectedTerminals = this . _terminalService . getReconnectedTerminals ( ReconnectionType ) ?. filter ( t => ! t . isDisposed && t . shellLaunchConfig . attachPersistentProcess ?. reconnectionProperties ?. data ) || [ ] ;
1325
+ this . _reconnectedTerminals = this . _terminalService . getReconnectedTerminals ( ReconnectionType ) ?. filter ( t => ! t . isDisposed && getReconnectionData ( t ) ) || [ ] ;
1327
1326
this . _logService . trace ( `Attempting reconnection of ${ this . _reconnectedTerminals ?. length } terminals` ) ;
1328
1327
if ( ! this . _reconnectedTerminals ?. length ) {
1329
1328
this . _logService . trace ( `No terminals to reconnect to so returning` ) ;
1330
1329
} else {
1331
1330
for ( const terminal of this . _reconnectedTerminals ) {
1332
- const data = terminal . shellLaunchConfig . attachPersistentProcess ?. reconnectionProperties ?. data as IReconnectionTaskData | undefined ;
1331
+ const data = getReconnectionData ( terminal ) as IReconnectionTaskData | undefined ;
1333
1332
if ( data ) {
1334
1333
const terminalData = { lastTask : data . lastTask , group : data . group , terminal } ;
1335
1334
this . _terminals [ terminal . instanceId ] = terminalData ;
1335
+ this . _logService . trace ( 'Reconnecting to task terminal' , terminalData . lastTask , terminal . instanceId ) ;
1336
1336
}
1337
1337
}
1338
1338
}
@@ -1837,3 +1837,7 @@ function taskShellIntegrationWaitOnExitSequence(message: string): (exitCode: num
1837
1837
return `${ VSCodeSequence ( VSCodeOscPt . CommandFinished , exitCode . toString ( ) ) } ${ message } ` ;
1838
1838
} ;
1839
1839
}
1840
+
1841
+ function getReconnectionData ( terminal : ITerminalInstance ) : IReconnectionTaskData | undefined {
1842
+ return terminal . shellLaunchConfig . attachPersistentProcess ?. reconnectionProperties ?. data as IReconnectionTaskData | undefined ;
1843
+ }
0 commit comments