fix(vim.system): resolve executable paths on windows

Fixes #31107
This commit is contained in:
Lewis Russell
2024-11-07 16:21:49 +00:00
committed by Lewis Russell
parent 7342e6b00d
commit ad3472e291
3 changed files with 20 additions and 2 deletions

View File

@@ -230,6 +230,8 @@ local function default_handler(stream, text, bucket)
end
end
local is_win = vim.fn.has('win32') == 1
local M = {}
--- @param cmd string
@@ -238,6 +240,13 @@ local M = {}
--- @param on_error fun()
--- @return uv.uv_process_t, integer
local function spawn(cmd, opts, on_exit, on_error)
if is_win then
local cmd1 = vim.fn.exepath(cmd)
if cmd1 ~= '' then
cmd = cmd1
end
end
local handle, pid_or_err = uv.spawn(cmd, opts, on_exit)
if not handle then
on_error()