-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Passing environment variables to debugger: 'env' or 'environment'? #22
Comments
What OS are you using? We could be clearer in the examples. The key/value pairs should go inside the array. So, something like this: [{"name":"value", "name2":"value2"}] Also, it looks like setting environment variables isn't working on mac. |
Ubuntu 16.04 beta 2. Thanks for clarifying. That sorted it! Works great! |
I reopened this issue because I was mistaken when I said that sorted it. When specifying anything in the 'environment' tag vscode reports the following error:
My debug launch script looks like this:
If I remove the contents of |
The correct format for this environment object is:
|
Closing as it looks like @krworks comment solves the problem |
Hey, I have the same error on OS X (running 10.11.6), running Code Version 1.4.0. Even though I'm passing environemnt variables to the debugger (in launch.json) with
it seems that the executable is run without those variable set beforehand. Edit: My bad, it seems that in OS X lldb is started without any environment variables set, due to system protection. However, is there any way, using Visual Studio Code, to pass specific commands to the debugger, once it has been started? For instance, on the command line I would do:
How would I achieve this, using Visual Studio Code? Thanks in advance |
This issue still seems to exist. I am unable to set LD_LIBRARY_PATH environment variable in Ubuntu 16.04. |
@nebjamin99 You can pass additional commands in the @dhiraj113 I noticed you opened another issue, #616. Please update that issue with the information requested. |
This doesnt seem to work on mac. Property environment is not allowed. |
@lohiarahul Can you confirm that your type field in your |
The debugging type is different. Its node. I guess it might have a different format. |
@lohiarahul Yea, This extension provides the |
anyone who's looking for a node example, this worked for me. {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// APPNAME=rap2 PORT=31000 DEBUG=*,-engine*,-socket.io*,-snapdragon*,-send,-express*,-nodemon*,-superagent,-AmpMetrics,-body-parser* nodemon server.js
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"cwd": "${workspaceFolder}/server",
"program": "${workspaceFolder}/server/server.js",
"env":
{
"APPNAME": "rap2",
"PORT": "31000"
}
}
]
} it's not very well documented here: |
also useful for node folks |
For my Java App on Mac also works like this configuration. |
they should really document this, I find my way back here every time I try messing around with the debugger before usually giving up anyway. |
@dcsan If you are using |
windows ? $env:path+=/xx/xx;/xxxx/xxx |
Could you please make it more explicit in the documentation that the expected format is to pass the name of the env variable and its value as values of the respective "name" and "value" keys in the json object? The "natural" way to describe the env var to me is |
@GPhilo Like this microsoft/vscode-docs#4492 and #7417 ? |
@sean-mcmanus That's much clearer now, thank you for the quick update! |
This works for python as well.
|
How can I reference the env var from "env" in my "args"? |
@bartekpacia also want to know if we can actually do this. The usage of |
@rafaeldsousa Apparently this is not possible. You can take a look at this issue. |
@bartekpacia I believe I was able to use a combination of
|
The documentation and examples for launch.json show the use of an object list (key/value pairs in {}) called 'env' for passing environment variables to a debugging session.
But on my version which I installed yesterday, it's an array ([]) called environment. Hovering over it to get Intellisense gives a description that corresponds with above.
How can I pass environment variables to the debugger?
The text was updated successfully, but these errors were encountered: