resolve_cli_on_path

Function resolve_cli_on_path 

Source
pub(crate) async fn resolve_cli_on_path(cli_command: &str) -> Option<String>
Expand description

Resolve a CLI command on the system PATH.

Uses where on Windows and which on Unix. Returns the absolute path if the command is found and exists, otherwise None.

On Windows we pass the bare command name (no .cmd suffix) so that where resolves the correct extension via PATHEXT. This correctly finds docker.exe, git.exe, node.exe AND npm.cmd — previously the hard-coded .cmd suffix caused all .exe-based tools (docker, git, node) to report as not installed even when present on PATH.

where can return multiple lines (e.g. Node.js ships both an extensionless npm Unix shell script and npm.cmd on Windows). We filter to the first line whose extension make_cli_cmd can actually spawn (.exe / .cmd / .bat). Taking the raw first line would yield the extensionless entry, which Command::new cannot run on Windows without a shell.