@@ -89,7 +89,7 @@ export class RemoteTerminalChannel extends Disposable implements IServerChannel<
89
89
uriTransformer : IURITransformer ;
90
90
} > ( ) ;
91
91
92
- private readonly _onExecuteCommand = this . _register ( new Emitter < { reqId : number ; commandId : string ; commandArgs : any [ ] } > ( ) ) ;
92
+ private readonly _onExecuteCommand = this . _register ( new Emitter < { reqId : number ; persistentProcessId : number ; commandId : string ; commandArgs : any [ ] } > ( ) ) ;
93
93
readonly onExecuteCommand = this . _onExecuteCommand . event ;
94
94
95
95
constructor (
@@ -240,21 +240,21 @@ export class RemoteTerminalChannel extends Disposable implements IServerChannel<
240
240
// Setup the CLI server to support forwarding commands run from the CLI
241
241
const ipcHandlePath = createRandomIPCHandle ( ) ;
242
242
env . VSCODE_IPC_HOOK_CLI = ipcHandlePath ;
243
+
244
+ const persistentProcessId = await this . _ptyService . createProcess ( shellLaunchConfig , initialCwd , args . cols , args . rows , args . unicodeVersion , env , baseEnv , args . options , args . shouldPersistTerminal , args . workspaceId , args . workspaceName ) ;
243
245
const commandsExecuter : ICommandsExecuter = {
244
- executeCommand : < T > ( id : string , ...args : any [ ] ) : Promise < T > => this . _executeCommand ( id , args , uriTransformer )
246
+ executeCommand : < T > ( id : string , ...args : any [ ] ) : Promise < T > => this . _executeCommand ( persistentProcessId , id , args , uriTransformer )
245
247
} ;
246
248
const cliServer = new CLIServerBase ( commandsExecuter , this . _logService , ipcHandlePath ) ;
247
-
248
- const id = await this . _ptyService . createProcess ( shellLaunchConfig , initialCwd , args . cols , args . rows , args . unicodeVersion , env , baseEnv , args . options , args . shouldPersistTerminal , args . workspaceId , args . workspaceName ) ;
249
- this . _ptyService . onProcessExit ( e => e . id === id && cliServer . dispose ( ) ) ;
249
+ this . _ptyService . onProcessExit ( e => e . id === persistentProcessId && cliServer . dispose ( ) ) ;
250
250
251
251
return {
252
- persistentTerminalId : id ,
252
+ persistentTerminalId : persistentProcessId ,
253
253
resolvedShellLaunchConfig : shellLaunchConfig
254
254
} ;
255
255
}
256
256
257
- private _executeCommand < T > ( commandId : string , commandArgs : any [ ] , uriTransformer : IURITransformer ) : Promise < T > {
257
+ private _executeCommand < T > ( persistentProcessId : number , commandId : string , commandArgs : any [ ] , uriTransformer : IURITransformer ) : Promise < T > {
258
258
let resolve ! : ( data : any ) => void ;
259
259
let reject ! : ( err : any ) => void ;
260
260
const result = new Promise < T > ( ( _resolve , _reject ) => {
@@ -277,6 +277,7 @@ export class RemoteTerminalChannel extends Disposable implements IServerChannel<
277
277
} ) ;
278
278
this . _onExecuteCommand . fire ( {
279
279
reqId,
280
+ persistentProcessId,
280
281
commandId,
281
282
commandArgs : serializedCommandArgs
282
283
} ) ;
0 commit comments