Skip to main content

which

Function which 

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

Check if a command exists in PATH.

§Arguments

  • cmd - The command to check

§Returns

  • Option<String> - The full path to the command if found, None otherwise

§Examples

use sal_process::which;

match which("git") {
    Some(path) => println!("Git is installed at: {}", path),
    None => println!("Git is not installed"),
}