@@ -111,26 +111,34 @@ export class TerminalProcessManager implements ITerminalProcessManager {
111
111
const activeWorkspaceRootUri = this . _historyService . getLastActiveWorkspaceRoot ( Schemas . file ) ;
112
112
this . initialCwd = terminalEnvironment . getCwd ( shellLaunchConfig , activeWorkspaceRootUri , this . _configHelper . config . cwd ) ;
113
113
114
- // Resolve env vars from config and shell
115
- const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? this . _workspaceContextService . getWorkspaceFolder ( activeWorkspaceRootUri ) : null ;
116
- const platformKey = platform . isWindows ? 'windows' : ( platform . isMacintosh ? 'osx' : 'linux' ) ;
117
- const envFromConfig = terminalEnvironment . resolveConfigurationVariables ( this . _configurationResolverService , { ...this . _configHelper . config . env [ platformKey ] } , lastActiveWorkspaceRoot ) ;
118
- const envFromShell = terminalEnvironment . resolveConfigurationVariables ( this . _configurationResolverService , { ...shellLaunchConfig . env } , lastActiveWorkspaceRoot ) ;
119
- shellLaunchConfig . env = envFromShell ;
120
-
121
114
// Compell type system as process.env should not have any undefined entries
122
- const env : platform . IProcessEnvironment = { ...process . env } as any ;
123
-
124
- // Merge process env with the env from config and from shellLaunchConfig
125
- terminalEnvironment . mergeEnvironments ( env , envFromConfig ) ;
126
- terminalEnvironment . mergeEnvironments ( env , shellLaunchConfig . env ) ;
127
-
128
- // Sanitize the environment, removing any undesirable VS Code and Electron environment
129
- // variables
130
- terminalEnvironment . sanitizeEnvironment ( env ) ;
131
-
132
- // Adding other env keys necessary to create the process
133
- terminalEnvironment . addTerminalEnvironmentKeys ( env , platform . locale , this . _configHelper . config . setLocaleVariables ) ;
115
+ let env : platform . IProcessEnvironment = { } ;
116
+
117
+ // When this is true, the caller must provide the complete environment as nothing will be inherited from the process
118
+ // or any configuration.
119
+ if ( shellLaunchConfig . strictEnv ) {
120
+ env = { ...shellLaunchConfig . env } as any ;
121
+ } else {
122
+ // Merge process env with the env from config and from shellLaunchConfig
123
+ env = { ...process . env } as any ;
124
+
125
+ // Resolve env vars from config and shell
126
+ const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? this . _workspaceContextService . getWorkspaceFolder ( activeWorkspaceRootUri ) : null ;
127
+ const platformKey = platform . isWindows ? 'windows' : ( platform . isMacintosh ? 'osx' : 'linux' ) ;
128
+ const envFromConfig = terminalEnvironment . resolveConfigurationVariables ( this . _configurationResolverService , { ...this . _configHelper . config . env [ platformKey ] } , lastActiveWorkspaceRoot ) ;
129
+ const envFromShell = terminalEnvironment . resolveConfigurationVariables ( this . _configurationResolverService , { ...shellLaunchConfig . env } , lastActiveWorkspaceRoot ) ;
130
+ shellLaunchConfig . env = envFromShell ;
131
+
132
+ terminalEnvironment . mergeEnvironments ( env , envFromConfig ) ;
133
+ terminalEnvironment . mergeEnvironments ( env , shellLaunchConfig . env ) ;
134
+
135
+ // Sanitize the environment, removing any undesirable VS Code and Electron environment
136
+ // variables
137
+ terminalEnvironment . sanitizeEnvironment ( env ) ;
138
+
139
+ // Adding other env keys necessary to create the process
140
+ terminalEnvironment . addTerminalEnvironmentKeys ( env , platform . locale , this . _configHelper . config . setLocaleVariables ) ;
141
+ }
134
142
135
143
this . _logService . debug ( `Terminal process launching` , shellLaunchConfig , this . initialCwd , cols , rows , env ) ;
136
144
this . _process = new TerminalProcess ( shellLaunchConfig , this . initialCwd , cols , rows , env , this . _configHelper . config . windowsEnableConpty ) ;
0 commit comments