mirror of
https://github.com/sharkdp/fd
synced 2024-10-01 13:33:55 +00:00
run cargo fmt
This commit is contained in:
parent
aefd6ac7af
commit
8360c9eaf4
|
@ -907,4 +907,3 @@ fn ensure_current_directory_exists(current_directory: &Path) -> anyhow::Result<(
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub fn execute_commands<I: Iterator<Item = io::Result<Command>>>(
|
||||||
cmd.output()
|
cmd.output()
|
||||||
} else {
|
} else {
|
||||||
// If running on only one thread, don't buffer output; instead just
|
// If running on only one thread, don't buffer output; instead just
|
||||||
// write directly to stdout. Allows for viewing and interacting with
|
// write directly to stdout. Allows for viewing and interacting with
|
||||||
// intermediate command output
|
// intermediate command output
|
||||||
cmd.spawn().and_then(|c| c.wait_with_output())
|
cmd.spawn().and_then(|c| c.wait_with_output())
|
||||||
};
|
};
|
||||||
|
@ -96,7 +96,7 @@ pub fn execute_commands<I: Iterator<Item = io::Result<Command>>>(
|
||||||
ExitCode::Success
|
ExitCode::Success
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes a command and pushes the path to the buffer if it succeeded with a
|
/// Executes a command and pushes the path to the buffer if it succeeded with a
|
||||||
/// non-zero exit code.
|
/// non-zero exit code.
|
||||||
pub fn execute_commands_filtering<I: Iterator<Item = io::Result<Command>>>(
|
pub fn execute_commands_filtering<I: Iterator<Item = io::Result<Command>>>(
|
||||||
path: &std::path::Path,
|
path: &std::path::Path,
|
||||||
|
@ -137,10 +137,10 @@ pub fn execute_commands_filtering<I: Iterator<Item = io::Result<Command>>>(
|
||||||
} else {
|
} else {
|
||||||
return ExitCode::GeneralError;
|
return ExitCode::GeneralError;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Err(why) => {
|
Err(why) => {
|
||||||
return handle_cmd_error(Some(&cmd), why);
|
return handle_cmd_error(Some(&cmd), why);
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_buffer.write();
|
output_buffer.write();
|
||||||
|
|
11
src/walk.rs
11
src/walk.rs
|
@ -409,9 +409,7 @@ impl WorkerState {
|
||||||
// This will be set to `Some` if the `--exec` argument was supplied.
|
// This will be set to `Some` if the `--exec` argument was supplied.
|
||||||
if let Some(ref cmd) = config.command {
|
if let Some(ref cmd) = config.command {
|
||||||
match cmd.get_mode() {
|
match cmd.get_mode() {
|
||||||
exec::ExecutionMode::Batch => {
|
exec::ExecutionMode::Batch => exec::batch(rx.into_iter().flatten(), cmd, config),
|
||||||
exec::batch(rx.into_iter().flatten(), cmd, config)
|
|
||||||
},
|
|
||||||
exec::ExecutionMode::OneByOne | exec::ExecutionMode::FilterResults => {
|
exec::ExecutionMode::OneByOne | exec::ExecutionMode::FilterResults => {
|
||||||
let out_perm = Mutex::new(());
|
let out_perm = Mutex::new(());
|
||||||
let filter = cmd.get_mode() == exec::ExecutionMode::FilterResults;
|
let filter = cmd.get_mode() == exec::ExecutionMode::FilterResults;
|
||||||
|
@ -424,8 +422,9 @@ impl WorkerState {
|
||||||
let rx = rx.clone();
|
let rx = rx.clone();
|
||||||
|
|
||||||
// Spawn a job thread that will listen for and execute inputs.
|
// Spawn a job thread that will listen for and execute inputs.
|
||||||
let handle = scope
|
let handle = scope.spawn(|| {
|
||||||
.spawn(|| exec::job(rx.into_iter().flatten(), cmd, &out_perm, config, filter));
|
exec::job(rx.into_iter().flatten(), cmd, &out_perm, config, filter)
|
||||||
|
});
|
||||||
|
|
||||||
// Push the handle of the spawned thread into the vector for later joining.
|
// Push the handle of the spawned thread into the vector for later joining.
|
||||||
handles.push(handle);
|
handles.push(handle);
|
||||||
|
@ -433,7 +432,7 @@ impl WorkerState {
|
||||||
let exit_codes = handles.into_iter().map(|handle| handle.join().unwrap());
|
let exit_codes = handles.into_iter().map(|handle| handle.join().unwrap());
|
||||||
merge_exitcodes(exit_codes)
|
merge_exitcodes(exit_codes)
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let stdout = io::stdout().lock();
|
let stdout = io::stdout().lock();
|
||||||
|
|
Loading…
Reference in a new issue