Global envvars overwrites process.env only when there's no terminal attached.#4786
Global envvars overwrites process.env only when there's no terminal attached.#4786saml wants to merge 1 commit intomicrosoft:masterfrom
Conversation
|
Hi @saml, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
…tached fixes microsoft#4779 Sometimes users want to launch `code` from terminal after modifying environment variables. When `code` is launched from terminal, it respects those modifications.
| if (!tty.isatty(1)) { | ||
| // Only assign global environment variables when | ||
| // STDOUT is not attached to terminal. | ||
| assign(process.env, userEnv); |
There was a problem hiding this comment.
Instead of testing if vscode is run from terminal, different assign method could be used. Maybe:
assign(userEnv, process.env); // session's envvar trumps login shell's envvar
process.env = userEnv;There was a problem hiding this comment.
https://nodejs.org/api/process.html#process_process_env
Assigning a property on process.env will implicitly convert the value to a string.
looks like I better not replace process.env like that unless I also modify userEnv's setter.
|
@saml, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
fixes #4779
Sometimes users want to launch
codefrom terminal aftermodifying environment variables.
When
codeis launched from terminal, it respects those modifications.