From 63326a3bbd4087abd9e1191586620ee3ed5883f7 Mon Sep 17 00:00:00 2001 From: Erick Karanja Date: Tue, 27 Jan 2026 12:10:41 +0300 Subject: [PATCH 1/2] find: implement {} path substitution for -exec A utility_name or argument containing only the two characters "{}" shall be replaced by the current pathname. --- src/find/matchers/exec.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/find/matchers/exec.rs b/src/find/matchers/exec.rs index 51337953..5aec69d5 100644 --- a/src/find/matchers/exec.rs +++ b/src/find/matchers/exec.rs @@ -53,7 +53,12 @@ impl SingleExecMatcher { impl Matcher for SingleExecMatcher { fn matches(&self, file_info: &WalkEntry, _: &mut MatcherIO) -> bool { - let mut command = Command::new(&self.executable); + let mut command; + if &self.executable == "{}" { + command = Command::new(file_info.path()); + } else { + command = Command::new(&self.executable); + } let path_to_file = if self.exec_in_parent_dir { if let Some(f) = file_info.path().file_name() { Path::new(".").join(f) From ba75262867974ced1ddb22b3ee9faa6787a4be5b Mon Sep 17 00:00:00 2001 From: Erick Karanja Date: Thu, 29 Jan 2026 20:11:25 +0300 Subject: [PATCH 2/2] format code for better coverage --- src/find/matchers/exec.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/find/matchers/exec.rs b/src/find/matchers/exec.rs index 5aec69d5..45c21734 100644 --- a/src/find/matchers/exec.rs +++ b/src/find/matchers/exec.rs @@ -53,8 +53,7 @@ impl SingleExecMatcher { impl Matcher for SingleExecMatcher { fn matches(&self, file_info: &WalkEntry, _: &mut MatcherIO) -> bool { - let mut command; - if &self.executable == "{}" { + let mut command = if &self.executable == "{}" { command = Command::new(file_info.path()); } else { command = Command::new(&self.executable);