This commit is contained in:
Jonah Caplan 2021-10-16 00:02:37 -04:00
parent a4a4709320
commit 91860bf682
5 changed files with 28 additions and 21 deletions

View file

@ -2,11 +2,11 @@ use std::path::PathBuf;
use std::sync::mpsc::Receiver;
use std::sync::{Arc, Mutex};
use crate::config::Config;
use crate::error::print_error;
use crate::exit_codes::{merge_exitcodes, ExitCode};
use crate::walk::WorkerResult;
use crate::filesystem::strip_current_dir;
use crate::config::Config;
use crate::walk::WorkerResult;
use super::CommandTemplate;
@ -60,7 +60,9 @@ pub fn batch(
buffer_output: bool,
config: &Arc<Config>,
) -> ExitCode {
let paths = rx.iter().filter_map(|value| match value {
let paths = rx
.iter()
.filter_map(|value| match value {
WorkerResult::Entry(val) => Some(val),
WorkerResult::Error(err) => {
if show_filesystem_errors {

View file

@ -144,7 +144,6 @@ impl CommandTemplate {
out_perm: Arc<Mutex<()>>,
buffer_output: bool,
) -> ExitCode {
let mut cmd = Command::new(self.args[0].generate(&input, self.path_separator.as_deref()));
for arg in &self.args[1..] {
cmd.arg(arg.generate(&input, self.path_separator.as_deref()));

View file

@ -179,7 +179,13 @@ fn spawn_receiver(
// This will be set to `Some` if the `--exec` argument was supplied.
if let Some(ref cmd) = config.command {
if cmd.in_batch_mode() {
exec::batch(rx, cmd, show_filesystem_errors, enable_output_buffering, &config)
exec::batch(
rx,
cmd,
show_filesystem_errors,
enable_output_buffering,
&config,
)
} else {
let shared_rx = Arc::new(Mutex::new(rx));

View file

@ -1944,6 +1944,6 @@ fn test_no_strip() {
te.assert_output(
&["c.foo", "./", "-X", "echo"],
"./one/two/C.Foo2 ./one/two/c.foo"
"./one/two/C.Foo2 ./one/two/c.foo",
)
}