commit | 8a13ffa045d80c5dee9335001e686c2d598bdc19 | [log] [tgz] |
---|---|---|
author | David LeGare <[email protected]> | Wed Mar 02 22:32:49 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Mar 02 22:32:49 2022 +0000 |
tree | 0ee35a94c440d4b17b59f4adbc625f2cee3fb7f3 | |
parent | ad52c5952240cac1c9a5414ffb602d5aa710f067 [diff] | |
parent | 6f0fadcda199702a28974afba6e4b75bf6a20b2a [diff] |
Update which to 4.2.4 am: 413469211c am: d4a8e3fb8d am: 8bc650c94f am: 90fdb407fc am: 6f0fadcda1 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/which/+/2004691 Change-Id: I93da0c96ea162abaa162d2ce2fd66f4a742eae01
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.