summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/_system.lua
diff options
context:
space:
mode:
authorBirdee <85372418+BirdeeHub@users.noreply.github.com>2025-06-25 15:15:19 -0700
committerGitHub <noreply@github.com>2025-06-25 15:15:19 -0700
commit731e616a79d01e4797badbb4e18d167c51125151 (patch)
treeb96c28e5a6713fcf79840a24e5737e417edcab47 /runtime/lua/vim/_system.lua
parent4369d7d9a7804b8f9c2254da9f153d428115334a (diff)
fix(vim.system): clear_env=true gives an invalid env to uv.spawn #33955
Problem: In setup_env, some needed logic is bypassed when clear_env=true. Solution: Drop the early return in setup_env(). Co-authored-by: BirdeeHub <birdee@localhost>
Diffstat (limited to 'runtime/lua/vim/_system.lua')
-rw-r--r--runtime/lua/vim/_system.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua
index 23a32fbd49..38e348bc03 100644
--- a/runtime/lua/vim/_system.lua
+++ b/runtime/lua/vim/_system.lua
@@ -208,15 +208,13 @@ end
--- @param clear_env? boolean
--- @return string[]?
local function setup_env(env, clear_env)
- if clear_env then
- return env
+ if not clear_env then
+ --- @type table<string,string|number>
+ env = vim.tbl_extend('force', base_env(), env or {})
end
- --- @type table<string,string|number>
- env = vim.tbl_extend('force', base_env(), env or {})
-
local renv = {} --- @type string[]
- for k, v in pairs(env) do
+ for k, v in pairs(env or {}) do
renv[#renv + 1] = string.format('%s=%s', k, tostring(v))
end