Skip to content

Commit

Permalink
Fixes #23788: tests output should be displayed even if not valid utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Nov 24, 2023
1 parent d5f5a18 commit 84d5f13
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions policies/rudderc/src/backends/unix/cfengine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ pub fn cf_agent(
.env("TMP_DIR", work_dir.path().to_string_lossy().to_string())
.env("CWD", std::env::current_dir()?)
.output()?;
let stdout = String::from_utf8(cmd.stdout)?;
let stderr = String::from_utf8(cmd.stderr)?;
let stdout = String::from_utf8_lossy(&cmd.stdout);
let stderr = String::from_utf8_lossy(&cmd.stderr);
if !cmd.status.success() {
bail!("Failed to run cf-agent:\nstdout: {stdout}\nstderr:{stderr}",);
} else {
Expand Down
4 changes: 2 additions & 2 deletions policies/rudderc/src/backends/windows/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub fn win_agent(

let run_log = Report::parse(&clean_reports.join("\n"))?;
debug!("reports: {}", reports);
debug!("stdout: {}", String::from_utf8(output.stdout)?);
debug!("stderr: {}", String::from_utf8(output.stderr)?);
debug!("stdout: {}", String::from_utf8_lossy(&output.stdout));
debug!("stderr: {}", String::from_utf8_lossy(&output.stderr));
Ok(run_log)
}
4 changes: 2 additions & 2 deletions policies/rudderc/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ impl Step {
bail!(
"Test '{}' failed\nstdout: {}\nstderr: {}",
&self.command,
String::from_utf8(output.stdout)?,
String::from_utf8(output.stderr)?,
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr),
)
}
Ok(())
Expand Down

0 comments on commit 84d5f13

Please sign in to comment.