mirror of
https://github.com/neovim/neovim.git
synced 2025-11-15 06:49:01 +00:00
fix(vim.system): env=nil passes env=nil to uv.spawn
731e616a79made it so passing `{env = nil, clear_env = true }` would pass `{env = {}}` to `vim.uv.spawn`. However this is not what `clear_env` is (arguably) supposed to do. If `env=nil` then that implies the uses wants `vim.uv.spawn()` to use the default environment. Adding `clear_env = true` simply prevents `NVIM` (the base environment) from being added. Fixes #34730 (cherry picked from commit4eebc46930)
This commit is contained in:
committed by
github-actions[bot]
parent
2d3517012a
commit
e732cbe36c
@@ -210,13 +210,18 @@ end
|
||||
--- @param clear_env? boolean
|
||||
--- @return string[]?
|
||||
local function setup_env(env, clear_env)
|
||||
if not env and clear_env then
|
||||
return
|
||||
end
|
||||
|
||||
env = env or {}
|
||||
if not clear_env then
|
||||
--- @type table<string,string|number>
|
||||
env = vim.tbl_extend('force', base_env(), env or {})
|
||||
env = vim.tbl_extend('force', base_env(), env)
|
||||
end
|
||||
|
||||
local renv = {} --- @type string[]
|
||||
for k, v in pairs(env or {}) do
|
||||
for k, v in pairs(env) do
|
||||
renv[#renv + 1] = string.format('%s=%s', k, tostring(v))
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user