@@ -27,7 +27,6 @@ import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/c
2727import type * as vscode from 'vscode' ;
2828import { ExtHostConfigProvider , IExtHostConfiguration } from '../common/extHostConfiguration' ;
2929import { IExtHostCommands } from 'vs/workbench/api/common/extHostCommands' ;
30- import { createHash } from 'crypto' ;
3130
3231export class ExtHostDebugService extends ExtHostDebugServiceBase {
3332
@@ -90,8 +89,8 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
9089
9190 const terminalName = args . title || nls . localize ( 'debug.terminal.title' , "Debug Process" ) ;
9291
93- const termKey = createKeyForShell ( shell , shellArgs , args ) ;
94- let terminal = await this . _integratedTerminalInstances . checkout ( termKey , terminalName , true ) ;
92+ const shellConfig = JSON . stringify ( { shell, shellArgs } ) ;
93+ let terminal = await this . _integratedTerminalInstances . checkout ( shellConfig , terminalName ) ;
9594
9695 let cwdForPrepareCommand : string | undefined ;
9796 let giveShellTimeToInitialize = false ;
@@ -103,7 +102,6 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
103102 cwd : args . cwd ,
104103 name : terminalName ,
105104 iconPath : new ThemeIcon ( 'debug' ) ,
106- env : args . env ,
107105 } ;
108106 giveShellTimeToInitialize = true ;
109107 terminal = this . _terminalService . createTerminalFromOptions ( options , {
@@ -113,7 +111,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
113111 forceShellIntegration : true ,
114112 useShellEnvironment : true
115113 } ) ;
116- this . _integratedTerminalInstances . insert ( terminal , termKey ) ;
114+ this . _integratedTerminalInstances . insert ( terminal , shellConfig ) ;
117115
118116 } else {
119117 cwdForPrepareCommand = args . cwd ;
@@ -145,7 +143,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
145143 }
146144 }
147145
148- const command = prepareCommand ( shell , args . args , ! ! args . argsCanBeInterpretedByShell , cwdForPrepareCommand ) ;
146+ const command = prepareCommand ( shell , args . args , ! ! args . argsCanBeInterpretedByShell , cwdForPrepareCommand , args . env ) ;
149147 terminal . sendText ( command ) ;
150148
151149 // Mark terminal as unused when its session ends, see #112055
@@ -165,14 +163,6 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
165163 }
166164}
167165
168- /** Creates a key that determines how terminals get reused */
169- function createKeyForShell ( shell : string , shellArgs : string | string [ ] , args : DebugProtocol . RunInTerminalRequestArguments ) {
170- const hash = createHash ( 'sha256' ) ;
171- hash . update ( JSON . stringify ( { shell, shellArgs } ) ) ;
172- hash . update ( JSON . stringify ( Object . entries ( args . env || { } ) . sort ( ( [ k1 ] , [ k2 ] ) => k1 . localeCompare ( k2 ) ) ) ) ;
173- return hash . digest ( 'base64' ) ;
174- }
175-
176166let externalTerminalService : IExternalTerminalService | undefined = undefined ;
177167
178168function runInExternalTerminal ( args : DebugProtocol . RunInTerminalRequestArguments , configProvider : ExtHostConfigProvider ) : Promise < number | undefined > {
0 commit comments