diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-11-07 16:21:49 +0000 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-11-08 16:29:44 +0000 |
commit | ad3472e291694b6c589d8a664459b03962eaac95 (patch) | |
tree | 197a9c110fa4d506a77cb8f2a8f53185f3f40515 /runtime/lua/vim/_system.lua | |
parent | 7342e6b00d5e9f67fd5ad4d3fadaf7e501598486 (diff) | |
download | rneovim-ad3472e291694b6c589d8a664459b03962eaac95.tar.gz rneovim-ad3472e291694b6c589d8a664459b03962eaac95.tar.bz2 rneovim-ad3472e291694b6c589d8a664459b03962eaac95.zip |
fix(vim.system): resolve executable paths on windows
Fixes #31107
Diffstat (limited to 'runtime/lua/vim/_system.lua')
-rw-r--r-- | runtime/lua/vim/_system.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua index 9e27b4c152..ce5dbffeaa 100644 --- a/runtime/lua/vim/_system.lua +++ b/runtime/lua/vim/_system.lua @@ -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() |