Skip to main content

resolve_npm_cli

Function resolve_npm_cli 

Source
pub fn resolve_npm_cli(name: &str) -> PathBuf
Expand description

Resolve a Node/npm-style CLI name to an executable path.

Resolution order:

  1. Env var <NAME_UPPERCASE>_BINARY (e.g. CLAUDE_BINARY, CODEX_BINARY) — if set, returned verbatim. Lets users pin a specific binary.
  2. On Windows: probe <name>.exe, then <name>.cmd, then <name>.ps1 via the which crate (which respects PATH and is independent of cmd.exe’s PATHEXT handling).
  3. Fallback: return PathBuf::from(name) so Command::new() behaves identically to the pre-resolver code on platforms where probing finds nothing.