Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables from launch.json need escaping when "console" is set to either "integratedTerminal" or "externalTerminal" #28193

Closed
pprice opened this issue Jun 7, 2017 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@pprice
Copy link
Contributor

pprice commented Jun 7, 2017

  • VSCode Version: 1.12.2
  • OS Version: Windows 10, OSX Sierra (tested both)

We use launch.json env block for configuration of software (think nconf or similar). We found this by a number of things:

  • For the inspector debug protocol, process.stdout.write does not get echod to the debug console, so we switched to integratedTerminal.
  • We have some config we set that are endpoints, some of these endpoints have url query params in them, thus the &

Steps to Reproduce:

  1. Set bash as your integrated shell
  2. Add the following env to your launch.json for a node type project
"env": {
    "foo": "bar&bar",
    "foo2": "hello"
}
  1. Debug (F5) the project

Expected:
process.env.foo === "bar&bar" && process.env.foo2 === "hello"

Actual:
No environment variables from launch.json (process.env) are set.

Diagnosis:
VSCode needs to escape (quote?) the values when starting a debug target within the context of a terminal (integrated or external). When the environment variables are set, vscode does something like this on launch:

foo=bar&bar
foo2=hello

It should be something like

foo="bar&bar"
foo2="hello"

Otherwise the & is interpreted as a fork operator (for bash at-least). This would enable someone to do something like:

"env": { 
     "foo": "bar&echo hello world" 
}
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues bug Issue identified by VS Code Team member as probable bug labels Aug 18, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

2 participants