From 10a896ab9b0089a5ff9af4870488a6c604887cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Wed, 8 Feb 2023 22:09:32 +0100 Subject: xtask: Propagate stdio/stderr, exitcodes --- xtask/src/command.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'xtask/src/command.rs') diff --git a/xtask/src/command.rs b/xtask/src/command.rs index 07ecc84..d894fae 100644 --- a/xtask/src/command.rs +++ b/xtask/src/command.rs @@ -1,4 +1,4 @@ -use crate::{debug, info, RunResult, Sizearguments, TestRunError}; +use crate::{debug, RunResult, Sizearguments, TestRunError}; use core::fmt; use os_pipe::pipe; use std::{fs::File, io::Read, process::Command}; @@ -315,19 +315,17 @@ pub fn run_command(command: &CargoCommand) -> anyhow::Result { .spawn()?; // retrieve output and clean up - let mut output = String::new(); - reader.read_to_string(&mut output)?; + let mut stdout = String::new(); + reader.read_to_string(&mut stdout)?; let exit_status = handle.wait()?; - let mut error_output = String::new(); - error_reader.read_to_string(&mut error_output)?; - if !error_output.is_empty() { - info!("{error_output}"); - } + let mut stderr = String::new(); + error_reader.read_to_string(&mut stderr)?; Ok(RunResult { exit_status, - output, + stdout, + stderr, }) } @@ -346,10 +344,10 @@ pub fn run_successful(run: &RunResult, expected_output_file: &str) -> Result<(), file: expected_output_file.to_owned(), })?; - if expected_output != run.output { + if expected_output != run.stdout { Err(TestRunError::FileCmpError { expected: expected_output.clone(), - got: run.output.clone(), + got: run.stdout.clone(), }) } else if !run.exit_status.success() { Err(TestRunError::CommandError(run.clone())) -- cgit v1.2.3