Skip to content

Commit ad9a444

Browse files
committed
avoid overlapping stderr
1 parent 50b3583 commit ad9a444

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/bootstrap/render_tests.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! to reimplement all the rendering logic in this module because of that.
88
99
use crate::builder::Builder;
10-
use std::io::{BufRead, BufReader, Write};
10+
use std::io::{BufRead, BufReader, Cursor, Write};
1111
use std::process::{ChildStdout, Command, Stdio};
1212
use std::time::Duration;
1313
use yansi_term::Color;
@@ -43,6 +43,7 @@ pub(crate) fn try_run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
4343

4444
fn run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
4545
cmd.stdout(Stdio::piped());
46+
cmd.stderr(Stdio::piped());
4647

4748
builder.verbose(&format!("running: {cmd:?}"));
4849

@@ -52,15 +53,20 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
5253
// run this on another thread since the builder is not Sync.
5354
Renderer::new(process.stdout.take().unwrap(), builder).render_all();
5455

55-
let result = process.wait().unwrap();
56-
if !result.success() && builder.is_verbose() {
56+
let result = process.wait_with_output().unwrap();
57+
if !result.status.success() && builder.is_verbose() {
5758
println!(
5859
"\n\ncommand did not execute successfully: {cmd:?}\n\
59-
expected success, got: {result}"
60+
expected success, got: {}",
61+
result.status
6062
);
6163
}
6264

63-
result.success()
65+
// Show the stderr emitted by the test runner at the end. As of 2023-03-02 this is only the
66+
// message at the end of a failed compiletest run.
67+
std::io::copy(&mut Cursor::new(&result.stderr), &mut std::io::stderr().lock()).unwrap();
68+
69+
result.status.success()
6470
}
6571

6672
struct Renderer<'a> {

0 commit comments

Comments
 (0)