Skip to content

Commit 0a57612

Browse files
committed
migrate render test to new bootstrap command streaming API's
1 parent b891d9a commit 0a57612

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/bootstrap/src/utils/render_tests.rs

Lines changed: 7 additions & 11 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 std::io::{BufRead, BufReader, Read, Write};
10-
use std::process::{ChildStdout, Stdio};
10+
use std::process::ChildStdout;
1111
use std::time::Duration;
1212

1313
use termcolor::{Color, ColorSpec, WriteColor};
@@ -52,32 +52,28 @@ pub(crate) fn try_run_tests(
5252
}
5353

5454
fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> bool {
55-
let cmd = cmd.as_command_mut();
56-
cmd.stdout(Stdio::piped());
57-
5855
builder.verbose(|| println!("running: {cmd:?}"));
5956

60-
let mut process = cmd.spawn().unwrap();
57+
let mut streaming_command = cmd.stream_capture_stdout(&builder.config.exec_ctx).unwrap();
6158

6259
// This runs until the stdout of the child is closed, which means the child exited. We don't
6360
// run this on another thread since the builder is not Sync.
64-
let renderer = Renderer::new(process.stdout.take().unwrap(), builder);
61+
let renderer = Renderer::new(streaming_command.stdout.take().unwrap(), builder);
6562
if stream {
6663
renderer.stream_all();
6764
} else {
6865
renderer.render_all();
6966
}
7067

71-
let result = process.wait_with_output().unwrap();
72-
if !result.status.success() && builder.is_verbose() {
68+
let status = streaming_command.wait().unwrap();
69+
if !status.success() && builder.is_verbose() {
7370
println!(
7471
"\n\ncommand did not execute successfully: {cmd:?}\n\
75-
expected success, got: {}",
76-
result.status
72+
expected success, got: {status}",
7773
);
7874
}
7975

80-
result.status.success()
76+
status.success()
8177
}
8278

8379
struct Renderer<'a> {

0 commit comments

Comments
 (0)