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

fix: remove unnecessary printlns #960

Merged
merged 1 commit into from
Feb 22, 2024
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
16 changes: 11 additions & 5 deletions src/command_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ fn write_warning(line: &[u8]) {
stdout.write_all(b"\n").unwrap();
}

fn wait_on_child(cmd: &Command, program: &str, child: &mut Child) -> Result<(), Error> {
fn wait_on_child(
cmd: &Command,
program: &str,
child: &mut Child,
cargo_output: &CargoOutput,
) -> Result<(), Error> {
StderrForwarder::new(child).forward_all();

let status = match child.wait() {
Expand All @@ -211,7 +216,8 @@ fn wait_on_child(cmd: &Command, program: &str, child: &mut Child) -> Result<(),
));
}
};
println!("{}", status);

cargo_output.print_warning(&status);

if status.success() {
Ok(())
Expand Down Expand Up @@ -280,7 +286,7 @@ pub(crate) fn run(
cargo_output: &CargoOutput,
) -> Result<(), Error> {
let mut child = spawn(cmd, program, cargo_output)?;
wait_on_child(cmd, program, &mut child)
wait_on_child(cmd, program, &mut child, cargo_output)
}

pub(crate) fn run_output(
Expand All @@ -300,7 +306,7 @@ pub(crate) fn run_output(
.read_to_end(&mut stdout)
.unwrap();

wait_on_child(cmd, program, &mut child)?;
wait_on_child(cmd, program, &mut child, cargo_output)?;

Ok(stdout)
}
Expand All @@ -320,7 +326,7 @@ pub(crate) fn spawn(
}
}

println!("running: {:?}", cmd);
cargo_output.print_warning(&format_args!("running: {:?}", cmd));

let cmd = ResetStderr(cmd);
let child = cmd.0.stderr(cargo_output.stdio_for_warnings()).spawn();
Expand Down