diff --git a/Cargo.lock b/Cargo.lock index 478b208..e9baf62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,7 +171,7 @@ dependencies = [ [[package]] name = "boxxy" -version = "0.7.0" +version = "0.7.1" dependencies = [ "atty", "bat", diff --git a/Cargo.toml b/Cargo.toml index 20120d2..1523512 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "boxxy" -version = "0.7.0" +version = "0.7.1" edition = "2021" repository = "https://github.com/queer/boxxy" diff --git a/src/enclosure/rule.rs b/src/enclosure/rule.rs index b81d10e..bbf088c 100644 --- a/src/enclosure/rule.rs +++ b/src/enclosure/rule.rs @@ -160,10 +160,18 @@ impl Rule { } // Resolve both program and rule_binary with `which` and compare. ex. /usr/bin/ls == /usr/bin/ls - let which_rule_binary = which::which(rule_binary)?; - let which_user_program = which::which(program)?; + let which_rule_binary = match which::which(rule_binary) { + Ok(which_rule_binary) => Some(which_rule_binary), + Err(_) => None, + }; + let which_user_program = match which::which(program) { + Ok(which_user_program) => Some(which_user_program), + Err(_) => None, + }; debug!("{}: comparing binaries with which(1): which_user_program={which_user_program:?}, which_rule_binary={which_rule_binary:?}", self.name); - if which_rule_binary == which_user_program { + if which_rule_binary == which_user_program + && (which_rule_binary.is_some() || which_user_program.is_some()) + { return Ok(true); }