Skip to main content

which

Function which 

Source
pub fn which(cmd: &str) -> Option<PathBuf>
Expand description

Command lookup. Re-exported so existing callers keep this path; the implementation moved to loopsmith-util once it turned out to have been written three times across the workspace, in three states of correctness. Resolve a command the way a shell would: absolute paths (and anything containing a separator) are checked directly, bare names are resolved against PATH.

A candidate counts only if it is executable. Checking is_file() alone — which two of the three previous copies of this function did — reports a non-executable file on PATH as an available command, and the failure then surfaces much later as a confusing spawn error.