Skip to main content

resolve_command

Function resolve_command 

Source
pub fn resolve_command<P, PI, N>(paths: P, filename: N) -> Option<PathBuf>
where P: IntoIterator<Item = PI>, PI: AsRef<Path>, N: AsRef<Path>,
Expand description

Resolves a command name the way the shell does when it is about to run it.

Returns the first executable in search order, or – if there is none – the first entry that exists and is not a directory, which the shell reports as the command and then fails to run.

§Arguments

  • paths - An iterator over the paths to search.
  • filename - The name of the command to resolve.