Skip to content

Cannot pass environment variable that is already defined in shell's rc file. #4779

@saml

Description

@saml
  • VSCode Version: 0.10.11
  • OS Version: Ubuntu 14.04

Steps to Reproduce:

  1. Export a variable in your default shell (~/.zlogin for zsh; ~/.bash_login for bash, for example. You can use .bashrc as well).

    export FOOBAR="1"
  2. Pass different value of the same variable to VSCode.

    FOOBAR=2 code .
  3. VSCode uses value defined for login shell, not current session:

Help > Toggle Developer Tools. And in Console, process.env.FOOBAR gives "1" when I expect "2".

It looks like VSCode executes default shell as login shell again before launching the program UI.

Being able to pass different values for existing environment variables greatly helps writing/testing extensions.

Related discussion: microsoft/vscode-go#220 (comment)

strace example:
$ strace -E GOPATH=1 -E FOOBAR=2 -s 1000000 -e verbose=execve -e abbrev=none ./.build/electron/electron  .
execve("./.build/electron/electron", ["./.build/electron/electron", "."], [... "GOPATH=1", ...]) # What I expected
...
read(62, "...\nGOPATH=/home/saml/go\n....")  # What is this?
...

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions