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
Setting environment variables for DAP terminal requests #90375
Comments
@weinand this is a pretty easy to hit bug with js-debug; if you think the proposed fix is the way to go (omitted the |
I don't understand the connection between setting environment variables and the debugger seeing nvm and attaching to that first? |
js-debug uses the |
@connor4312 and the fix involves launching the terminal without
|
Essentially yes. prepareCommand has logic that does this already, which we omit for the first launch and instead set the variables on a terminal. I propose always using prepareCommand's version of variable setting. vscode/src/vs/workbench/contrib/debug/node/terminals.ts Lines 114 to 123 in a0328d2
|
@connor4312 I think your proposal makes sense, please go ahead and fix this. But what does this mean for the debug terminal? |
That's right, any node process with that environment variable will be debugged, including build tools. |
That excludes anything nodemon-based. A workaround would be to run those build tools via |
I didn't have an issue trying to boot and break in a program with nodemon in the debug terminal. It looks like killing and letting nodemon reboot the program works, though when the debug session gets terminated it'll kill everything. Are there issues you anticipate running Nodemon in the debug terminal? |
Continuing microsoft/vscode-js-debug#318
We use environment variables to wire up Node for debugging, and send them through the
env
option in the DAPrunInTerminal
request. This causes the following issue:I think the best solution from my point of view would be to never set the environment variables on the global terminal level, and always set them per-command. We actually do this already in
prepareCommand
if we're going to reuse a terminal.vscode/src/vs/workbench/api/node/extHostDebugService.ts
Lines 111 to 112 in a0328d2
This would also be a little more consistent for debuggers. For instance, if I had
env: { FOO: '1' }
in my first launch request, andenv: { BAR: '2' }
in the second request, the launched process would seeenv: { FOO: '1', BAR: '2' }
since it would inherit the previous environment variables set on a terminal level as well as the new variables set for the specific process.The text was updated successfully, but these errors were encountered: