diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-10 18:43:31 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-10 18:43:31 +0800 |
| commit | d7f32c05222ec860014ac29d807903ae7fa56258 (patch) | |
| tree | 9236dd4209699fe48575a5d8980e917270f497c4 | |
| parent | d652ed8c00bb84503d3f4c75c4a30d6b9827e005 (diff) | |
fix: combine stdout and stderr in command output
Prefer both streams when present so failures with stderr
warnings still include stdout details like test assertions.
| -rw-r--r-- | .run/src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/.run/src/lib.rs b/.run/src/lib.rs index 05b8e12..b17a61f 100644 --- a/.run/src/lib.rs +++ b/.run/src/lib.rs @@ -203,7 +203,15 @@ pub fn run_cmd_capture_with_dir( let exit_code = output.status.code().unwrap_or(1); let stderr = String::from_utf8_lossy(&output.stderr).to_string(); let stdout = String::from_utf8_lossy(&output.stdout).to_string(); - let combined = if stderr.is_empty() { stdout } else { stderr }; + // Keep both streams so a failure is never hidden: when stderr carries + // warnings, the real failure details (e.g. the failing test name and + // assertion diff) usually live on stdout and must not be dropped. + let combined = match (stdout.trim().is_empty(), stderr.trim().is_empty()) { + (false, false) => format!("{stdout}\n{stderr}"), + (false, true) => stdout, + (true, false) => stderr, + (true, true) => stdout, + }; if exit_code == 0 { Ok(combined) |
