Skip to content

Commit ac7c1bc

Browse files
committed
fix: resolve command to full exec path for Windows PATHEXT
1 parent 37a53a7 commit ac7c1bc

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lua/agentic/acp/acp_transport.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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 },

0 commit comments

Comments
 (0)