Skip to content

Commit

Permalink
Merge pull request #1462 from rajatjindal/fix-stdout-logging
Browse files Browse the repository at this point in the history
fix stdout line breaks
  • Loading branch information
rajatjindal authored May 9, 2023
2 parents d15b469 + 48f7201 commit d59fe6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/e2e-testing/src/spin_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Controller for SpinUp {
utils::get_output_from_stderr(Some(stderr_stream), Duration::from_secs(2))
.await?;
return Err(anyhow!(
"error running spin up.\nstdout {:?}\nstderr: {:?}\n",
"error running spin up.\nstdout {:#?}\nstderr: {:#?}\n",
stdout_logs,
stderr_logs
));
Expand Down
13 changes: 10 additions & 3 deletions crates/e2e-testing/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ pub fn run<S: Into<String> + AsRef<OsStr>>(
let output = cmd.output()?;
let code = output.status.code().expect("should have status code");
if code != 0 {
println!("{:#?}", std::str::from_utf8(&output.stderr)?);
println!("{:#?}", std::str::from_utf8(&output.stdout)?);
panic!("command `{:?}` exited with code {}", cmd, code);
let stdout = std::str::from_utf8(&output.stdout)?
.lines()
.collect::<Vec<&str>>();
let stderr = std::str::from_utf8(&output.stderr)?
.lines()
.collect::<Vec<&str>>();
panic!(
"command `{:?}` exited with code {}.\n\nstdout:\n{:#?}\n\nstderr:\n{:#?}\n",
cmd, code, stdout, stderr
);
}

Ok(output)
Expand Down

0 comments on commit d59fe6f

Please sign in to comment.