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

Fix run in external terminal not propagating environment variables to program #1318

Merged

Conversation

sewbacca
Copy link
Contributor

This PR fixes #1317
and correctly passes environment variables to the program

@sewbacca sewbacca force-pushed the fix-external-terminal-environ branch from 29393ab to 854e093 Compare August 16, 2024 14:04
lua/dap/session.lua Outdated Show resolved Hide resolved
@sewbacca sewbacca force-pushed the fix-external-terminal-environ branch from 854e093 to b8e54ac Compare August 17, 2024 09:48
@sewbacca
Copy link
Contributor Author

Rereading the code, I do not handle null env unset requests. I suppose this would also affect integrated terminals, but it would need consideration of the consequences having vim.NILs flying around:

local function json_decode(payload)
return vim.json.decode(payload, { luanil = { object = true }})
end

@mfussenegger
Copy link
Owner

Rereading the code, I do not handle null env unset requests. I suppose this would also affect integrated terminals, but it would need consideration of the consequences having vim.NILs flying around:

local function json_decode(payload)
return vim.json.decode(payload, { luanil = { object = true }})
end

I think that's okay for now. That can be fixed later if it ever causes an actual problem with an adapter making use of it.

@mfussenegger mfussenegger merged commit 33b3973 into mfussenegger:master Aug 18, 2024
4 checks passed
mfussenegger pushed a commit that referenced this pull request Sep 28, 2024
Follow up to #1318

The intention of that change was to honor environment variables sent by the
debug adapter, but it also unintentionally changed behavior to no longer
inherit the parent environment if no `env` option was provided by the debug
adapter.

This fixes it, so that:

- No `env` provided: Use parent environment
- `env` provided: Merge with parent environment. (`env` having higher priority)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run in external terminal does not propagate environment variables correctly
2 participants