Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make multi-exec only match {} + with nothing in between #91

Merged
merged 1 commit into from
Mar 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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