Skip to main content

resolve_binary

Function resolve_binary 

Source
pub fn resolve_binary(name: &str) -> Result<PathBuf>
Expand description

Resolve a binary name to its full path, honoring PATHEXT on Windows.

On Windows, Node.js tools are installed as .CMD/.BAT/.PS1 shims. Rust’s std::process::Command::new() does NOT honor PATHEXT, so Command::new("vitest") fails even when vitest.CMD is on PATH.

This function uses the which crate to perform proper PATH+PATHEXT resolution.

§Arguments

  • name - Binary name (e.g., “vitest”, “eslint”, “tsc”)

§Returns

Full path to the resolved binary, or error if not found.