commit | 26231abccad62babd685946bbbfbc49686f62eac | [log] [tgz] |
---|---|---|
author | Linux Build Service Account <lnxbuild@localhost> | Tue Apr 05 09:58:11 2022 -0700 |
committer | Linux Build Service Account <lnxbuild@localhost> | Tue Apr 05 09:58:11 2022 -0700 |
tree | 0ee35a94c440d4b17b59f4adbc625f2cee3fb7f3 | |
parent | a314f736f15a519f8aea11819322420208d38ccd [diff] | |
parent | 35234329bdbdedb035c08d505d37decb3446e99c [diff] |
Merge 35234329bdbdedb035c08d505d37decb3446e99c on remote branch Change-Id: I6ceae00d1dff44160bec69fcbadb3807ff76966f
A Rust equivalent of Unix command "which". Locate installed executable in cross platforms.
To find which rustc executable binary is using.
use which::which; let result = which("rustc").unwrap(); assert_eq!(result, PathBuf::from("/usr/bin/rustc"));
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()));
The documentation is available online.