File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,21 @@ local spawn = {
1313 _flatten_cmd_args = _ .compose (_ .filter (is_not_nil ), _ .flatten ),
1414}
1515
16+ --- @param cmd string
17+ local function exepath (cmd )
18+ if platform .is .win then
19+ -- On Windows, exepath() assumes the system is capable of executing "Unix-like" executables if the shell is a Unix
20+ -- shell. We temporarily override it to a Windows shell ("powershell") to avoid that behaviour.
21+ local old_shell = vim .o .shell
22+ vim .o .shell = " powershell"
23+ local expanded_cmd = vim .fn .exepath (cmd )
24+ vim .o .shell = old_shell
25+ return expanded_cmd
26+ else
27+ return vim .fn .exepath (cmd )
28+ end
29+ end
30+
1631local function Failure (err , cmd )
1732 return Result .failure (setmetatable (err , {
1833 __tostring = function ()
@@ -67,7 +82,7 @@ setmetatable(spawn, {
6782 -- in PATH.
6883 if platform .is .win and (spawn_args .env and has_path (spawn_args .env )) == nil then
6984 a .scheduler ()
70- local expanded_cmd = vim . fn . exepath (canonical_cmd )
85+ local expanded_cmd = exepath (canonical_cmd )
7186 if expanded_cmd ~= " " then
7287 cmd = expanded_cmd
7388 end
You can’t perform that action at this time.
0 commit comments