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:
Harivansh Rathi 2026-02-22 11:55:13 -05:00 committed by Barrett Ruth
parent ff5ba39a59
commit 484a4a56d0

View file

@ -20,6 +20,15 @@ local function syshandle(result)
return { success = true, data = data }
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 subcommand string
---@param args string[]
@ -56,7 +65,7 @@ local function run_scraper(platform, subcommand, args, opts)
handle = uv.spawn(cmd[1], {
args = vim.list_slice(cmd, 2),
stdio = { nil, stdout, stderr },
env = env,
env = spawn_env_list(env),
cwd = plugin_path,
}, function(code, signal)
if buf ~= '' and opts.on_event then