aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_system.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /runtime/lua/vim/_system.lua
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'runtime/lua/vim/_system.lua')
-rw-r--r--runtime/lua/vim/_system.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua
index d603971495..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()
@@ -309,11 +318,9 @@ end
--- @param on_exit? fun(out: vim.SystemCompleted)
--- @return vim.SystemObj
function M.run(cmd, opts, on_exit)
- vim.validate({
- cmd = { cmd, 'table' },
- opts = { opts, 'table', true },
- on_exit = { on_exit, 'function', true },
- })
+ vim.validate('cmd', cmd, 'table')
+ vim.validate('opts', opts, 'table', true)
+ vim.validate('on_exit', on_exit, 'function', true)
opts = opts or {}