Skip to content

Commit 320d7fc

Browse files
marcoienisharkdp
authored andcommitted
Sort search results when using -X option
1 parent f7d1938 commit 320d7fc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/exec/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,15 @@ impl CommandTemplate {
170170
cmd.stdout(Stdio::inherit());
171171
cmd.stderr(Stdio::inherit());
172172

173-
let mut paths = paths.map(|p| Self::prepare_path(&p));
173+
let mut paths: Vec<String> = paths.map(|p| Self::prepare_path(&p)).collect();
174174
let mut has_path = false;
175175

176176
for arg in &self.args[1..] {
177177
if arg.has_tokens() {
178+
paths.sort();
179+
178180
// A single `Tokens` is expected
179-
// So we can directy consume the iterator once and for all
181+
// So we can directly consume the iterator once and for all
180182
for path in &mut paths {
181183
cmd.arg(arg.generate(&path).as_ref());
182184
has_path = true;

0 commit comments

Comments
 (0)