Skip to content

Commit 36d1a4c

Browse files
hanbingssylvestre
authored andcommitted
Fix -ok and -okdir abnormal parameter detection.
1 parent bd55ede commit 36d1a4c

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/find/matchers/exec.rs

+19-18
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,6 @@ impl Matcher for SingleExecMatcher {
6767
file_info.path().to_path_buf()
6868
};
6969

70-
// support interactive exec
71-
if self.interactive {
72-
let tips = format!(
73-
"{} ... {} > ? [y/n]: ",
74-
self.executable,
75-
path_to_file.to_string_lossy()
76-
);
77-
#[allow(clippy::explicit_write)]
78-
write!(stdout(), "{}", tips).unwrap();
79-
stdout().flush().unwrap();
80-
81-
let mut input = String::new();
82-
let _result = stdin().read_line(&mut input).unwrap();
83-
if !input.trim().contains('y') {
84-
return false;
85-
}
86-
}
87-
8870
for arg in &self.args {
8971
match *arg {
9072
Arg::LiteralArg(ref a) => command.arg(a.as_os_str()),
@@ -105,6 +87,25 @@ impl Matcher for SingleExecMatcher {
10587
}
10688
}
10789
}
90+
91+
// support interactive exec
92+
if self.interactive {
93+
let tips = format!(
94+
"{} ... {} > ? [y/n]: ",
95+
self.executable,
96+
path_to_file.to_string_lossy()
97+
);
98+
#[allow(clippy::explicit_write)]
99+
write!(stdout(), "{}", tips).unwrap();
100+
stdout().flush().unwrap();
101+
102+
let mut input = String::new();
103+
let _result = stdin().read_line(&mut input).unwrap();
104+
if !input.trim().contains('y') {
105+
return false;
106+
}
107+
}
108+
108109
match command.status() {
109110
Ok(status) => status.success(),
110111
Err(e) => {

0 commit comments

Comments
 (0)