Skip to content

Commit

Permalink
Merge pull request #91 from tavianator/calm-exec-plus
Browse files Browse the repository at this point in the history
Make multi-exec only match {} + with nothing in between
  • Loading branch information
sylvestre authored Mar 28, 2021
2 parents 8ecc66f + 87c5caa commit 85e9615
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/find/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn build_matcher_tree(
"-exec" | "-execdir" => {
let mut arg_index = i + 1;
while arg_index < args.len() && args[arg_index] != ";" {
if args[arg_index] == "+" {
if args[arg_index - 1] == "{}" && args[arg_index] == "+" {
// MultiExecMatcher isn't written yet
return Err(From::from(format!(
"{} [args...] + isn't supported yet. \
Expand Down Expand Up @@ -948,6 +948,13 @@ mod tests {
.expect("parsing argument list with exec that takes brackets and -os should work");
}

#[test]
fn build_top_level_exec_plus_semicolon() {
let mut config = Config::default();
build_top_level_matcher(&["-exec", "foo", "{}", "foo", "+", ";"], &mut config)
.expect("only {} + should be considered a multi-exec");
}

#[test]
#[cfg(unix)]
fn build_top_level_matcher_perm() {
Expand Down

0 comments on commit 85e9615

Please sign in to comment.