Bug: 153120169

Clone this repo:
  1. 7b3816f Update TEST_MAPPING by Jeff Vander Stoep · 7 days ago master
  2. 93a6d69 Upgrade which to 4.3.0 by Jeff Vander Stoep · 7 weeks ago main-16k-with-phones
  3. 9c0bb67 Merge "Update TEST_MAPPING" am: 4ecdb53961 am: 238dc9d855 am: a24c6972f5 am: 536d105196 by Treehugger Robot · 8 months ago
  4. 536d105 Merge "Update TEST_MAPPING" am: 4ecdb53961 am: 238dc9d855 am: a24c6972f5 by Treehugger Robot · 8 months ago
  5. a24c697 Merge "Update TEST_MAPPING" am: 4ecdb53961 am: 238dc9d855 by Treehugger Robot · 8 months ago main-16k

Build Status

which

A Rust equivalent of Unix command “which”. Locate installed executable in cross platforms.

Support platforms

  • Linux
  • Windows
  • macOS

Examples

  1. To find which rustc executable binary is using.

    use which::which;
    
    let result = which("rustc").unwrap();
    assert_eq!(result, PathBuf::from("/usr/bin/rustc"));
    
  1. After enabling the regex feature, find all cargo subcommand executables on the path:

    use which::which_re;
    
    which_re(Regex::new("^cargo-.*").unwrap()).unwrap()
        .for_each(|pth| println!("{}", pth.to_string_lossy()));
    

Documentation

The documentation is available online.