summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-04-26 14:46:49 -0400
committerGitHub <noreply@github.com>2022-04-26 14:46:49 -0400
commita1b4aa2ae60d215e38c6871fae690e34964a27d7 (patch)
treec41baf3067ca2a618bd458f1101bf9cf98506dae /cli/tools
parentf07f246ae8a158e33e81aa4ccf225cd536795f50 (diff)
fix(test): capture inherited stdout and stderr for subprocesses in test output (#14395)
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/test.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs
index aab062a6c..d7817eb1a 100644
--- a/cli/tools/test.rs
+++ b/cli/tools/test.rs
@@ -83,10 +83,8 @@ pub struct TestDescription {
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestOutput {
- PrintStdout(String),
- PrintStderr(String),
- Stdout(Vec<u8>),
- Stderr(Vec<u8>),
+ String(String),
+ Bytes(Vec<u8>),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
@@ -351,18 +349,14 @@ impl TestReporter for PrettyTestReporter {
println!("{}", colors::gray("------- output -------"));
}
match output {
- TestOutput::PrintStdout(line) => {
+ TestOutput::String(line) => {
+ // output everything to stdout in order to prevent
+ // stdout and stderr racing
print!("{}", line)
}
- TestOutput::PrintStderr(line) => {
- eprint!("{}", line)
- }
- TestOutput::Stdout(bytes) => {
+ TestOutput::Bytes(bytes) => {
std::io::stdout().write_all(bytes).unwrap();
}
- TestOutput::Stderr(bytes) => {
- std::io::stderr().write_all(bytes).unwrap();
- }
}
}