mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
@@ -98,10 +98,29 @@ export class TerminalInstanceService implements ITerminalInstanceService {
|
||||
this._mainProcessParentEnv = env;
|
||||
}
|
||||
|
||||
// For macOS just return the root environment which seems to always be {}, this is the
|
||||
// parent of the main process when code is launched from the dock.
|
||||
// For macOS it doesn't appear to be possible to get the "root" environment as
|
||||
// `ps eww -o command` for PID 1 (the parent of the main process when launched from the
|
||||
// dock/finder) returns no environment, because of this we will fill in the root environment
|
||||
// using a whitelist of environment variables that we have.
|
||||
if (isMacintosh) {
|
||||
this._mainProcessParentEnv = {};
|
||||
// This list was generated by diffing launching a terminal with {} and the system
|
||||
// terminal launched from finder.
|
||||
const rootEnvVars = [
|
||||
'SHELL',
|
||||
'SSH_AUTH_SOCK',
|
||||
'Apple_PubSub_Socket_Render',
|
||||
'XPC_FLAGS',
|
||||
'XPC_SERVICE_NAME',
|
||||
'HOME',
|
||||
'LOGNAME',
|
||||
'TMPDIR'
|
||||
];
|
||||
rootEnvVars.forEach(k => {
|
||||
if (process.env[k]) {
|
||||
this._mainProcessParentEnv![k] = process.env[k]!;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Windows should return a fresh environment block, might need native code?
|
||||
|
||||
Reference in New Issue
Block a user