File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,6 +77,15 @@ function M.create_stdio_transport(config, callbacks)
7777 function transport :start ()
7878 callbacks .on_state_change (" connecting" )
7979
80+ -- Resolve command to full executable path for Windows OS PATHEXT support
81+ -- vim.fn.exepath handles .CMD, .EXE and .BAT extensions on Windows
82+ local command = vim .fn .exepath (config .command )
83+ if command == " " then
84+ -- if exepath returns empty, the command is not found in PATH
85+ callbacks .on_state_change (" error" )
86+ error (string.format (" Command not found: %s" , config .command ))
87+ end
88+
8089 local stdin = uv .new_pipe (false )
8190 local stdout = uv .new_pipe (false )
8291 local stderr = uv .new_pipe (false )
@@ -116,7 +125,7 @@ function M.create_stdio_transport(config, callbacks)
116125 end
117126
118127 --- @diagnostic disable-next-line : missing-fields
119- local handle , pid = uv .spawn (config . command , {
128+ local handle , pid = uv .spawn (command , {
120129 args = args ,
121130 env = final_env ,
122131 stdio = { stdin , stdout , stderr },
You can’t perform that action at this time.
0 commit comments