mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 22:40:09 +01:00
fix: use command -v instead of which
This commit is contained in:
parent
15c1ba3370
commit
76b99ff932
2 changed files with 4 additions and 3 deletions
|
|
@ -83,7 +83,7 @@ pattern = [
|
||||||
"pattern 1",
|
"pattern 1",
|
||||||
]
|
]
|
||||||
# this will add a `sudo` before the command if:
|
# 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`
|
# - the last command does not contain `sudo`
|
||||||
suggest = [
|
suggest = [
|
||||||
'''
|
'''
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,9 @@ fn eval_condition(condition: &str, arg: &str) -> TokenStream2 {
|
||||||
match condition {
|
match condition {
|
||||||
"executable" => {
|
"executable" => {
|
||||||
quote!{
|
quote!{
|
||||||
std::process::Command::new("which")
|
std::process::Command::new(shell)
|
||||||
.arg(#arg)
|
.arg("-c")
|
||||||
|
.arg(format!("command -v {}", #arg))
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute process")
|
.expect("failed to execute process")
|
||||||
.status
|
.status
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue