fix: use command -v instead of which

This commit is contained in:
iff 2023-08-08 10:40:47 +02:00
parent 15c1ba3370
commit 76b99ff932
2 changed files with 4 additions and 3 deletions

View file

@ -83,7 +83,7 @@ pattern = [
"pattern 1",
]
# this will add a `sudo` before the command if:
# - the `sudo` is found by `which`
# - the `sudo` is found by `command -v`
# - the last command does not contain `sudo`
suggest = [
'''

View file

@ -168,8 +168,9 @@ fn eval_condition(condition: &str, arg: &str) -> TokenStream2 {
match condition {
"executable" => {
quote!{
std::process::Command::new("which")
.arg(#arg)
std::process::Command::new(shell)
.arg("-c")
.arg(format!("command -v {}", #arg))
.output()
.expect("failed to execute process")
.status