Agent chat on Windows: start npm agents through their .cmd shim (#1530)

This commit is contained in:
bherbruck authored and GitHub committed 2026-10-15 18:36:41 -04:00
1 parent 73493b94c3
commit 6128a20c5f
2 files changed
+43 -4

No files matched your search

+4 -1
View File
@@ -51,8 +51,11 @@ impl ProcessHandle {
}
}
/// On Windows, npm installs `.cmd` shims, which only `cmd.exe` runs.
/// On Windows, npm installs `.cmd` shims, which only `cmd.exe` runs. A command saved as the bare
/// npm path (a shell script there) runs the shim beside it.
fn command_for(program: &str) -> Command {
let shim = if cfg!(windows) { super::discover::runnable_sibling(std::path::Path::new(program)) } else { None };
let program = shim.as_deref().and_then(|p| p.to_str()).unwrap_or(program);
let lower = program.to_ascii_lowercase();
if cfg!(windows) && (lower.ends_with(".cmd") || lower.ends_with(".bat")) {
let mut c = Command::new("cmd");