@@ -13,7 +13,7 @@ import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspac
13
13
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver' ;
14
14
import { sanitizeProcessEnvironment } from 'vs/base/common/processes' ;
15
15
import { IShellLaunchConfig , ITerminalBackend , ITerminalEnvironment , TerminalShellType , WindowsShellType } from 'vs/platform/terminal/common/terminal' ;
16
- import { IProcessEnvironment , isWindows , language , OperatingSystem } from 'vs/base/common/platform' ;
16
+ import { IProcessEnvironment , isWindows , isMacintosh , language , OperatingSystem } from 'vs/base/common/platform' ;
17
17
import { escapeNonWindowsPath , sanitizeCwd } from 'vs/platform/terminal/common/terminalEnvironment' ;
18
18
import { isString } from 'vs/base/common/types' ;
19
19
import { IHistoryService } from 'vs/workbench/services/history/common/history' ;
@@ -269,6 +269,26 @@ export async function createTerminalEnvironment(
269
269
}
270
270
}
271
271
272
+ // Workaround for https://github.com/microsoft/vscode/issues/204005
273
+ // We should restore the following environment variables when a user
274
+ // launches the application using the CLI so that integrated terminal
275
+ // can still inherit these variables.
276
+ // We are not bypassing the restrictions implied in https://github.com/electron/electron/pull/40770
277
+ // since this only affects integrated terminal and not the application itself.
278
+ if ( isMacintosh ) {
279
+ // Restore NODE_OPTIONS if it was set
280
+ if ( env [ 'VSCODE_NODE_OPTIONS' ] ) {
281
+ env [ 'NODE_OPTIONS' ] = env [ 'VSCODE_NODE_OPTIONS' ] ;
282
+ delete env [ 'VSCODE_NODE_OPTIONS' ] ;
283
+ }
284
+
285
+ // Restore NODE_REPL_EXTERNAL_MODULE if it was set
286
+ if ( env [ 'VSCODE_NODE_REPL_EXTERNAL_MODULE' ] ) {
287
+ env [ 'NODE_REPL_EXTERNAL_MODULE' ] = env [ 'VSCODE_NODE_REPL_EXTERNAL_MODULE' ] ;
288
+ delete env [ 'VSCODE_NODE_REPL_EXTERNAL_MODULE' ] ;
289
+ }
290
+ }
291
+
272
292
// Sanitize the environment, removing any undesirable VS Code and Electron environment
273
293
// variables
274
294
sanitizeProcessEnvironment ( env , 'VSCODE_IPC_HOOK_CLI' ) ;
0 commit comments