fix(scraper): pass uv.spawn env as KEY=VALUE list
Neovim/libuv spawn expects env as a list of KEY=VALUE strings. Passing the map from vim.fn.environ() can fail process startup with ENOENT, which breaks NDJSON test scraping and surfaces as 'Failed to start scraper process'.\n\nConvert env map to a deterministic list before uv.spawn in the NDJSON scraper path. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
ff5ba39a59
commit
484a4a56d0
1 changed files with 10 additions and 1 deletions
|
|
@ -20,6 +20,15 @@ local function syshandle(result)
|
||||||
return { success = true, data = data }
|
return { success = true, data = data }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function spawn_env_list(env_map)
|
||||||
|
local out = {}
|
||||||
|
for key, value in pairs(env_map) do
|
||||||
|
out[#out + 1] = tostring(key) .. '=' .. tostring(value)
|
||||||
|
end
|
||||||
|
table.sort(out)
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
---@param platform string
|
---@param platform string
|
||||||
---@param subcommand string
|
---@param subcommand string
|
||||||
---@param args string[]
|
---@param args string[]
|
||||||
|
|
@ -56,7 +65,7 @@ local function run_scraper(platform, subcommand, args, opts)
|
||||||
handle = uv.spawn(cmd[1], {
|
handle = uv.spawn(cmd[1], {
|
||||||
args = vim.list_slice(cmd, 2),
|
args = vim.list_slice(cmd, 2),
|
||||||
stdio = { nil, stdout, stderr },
|
stdio = { nil, stdout, stderr },
|
||||||
env = env,
|
env = spawn_env_list(env),
|
||||||
cwd = plugin_path,
|
cwd = plugin_path,
|
||||||
}, function(code, signal)
|
}, function(code, signal)
|
||||||
if buf ~= '' and opts.on_event then
|
if buf ~= '' and opts.on_event then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue