Use String::from_utf8_lossy

This commit is contained in:
Felix Schütt
2023-01-02 10:28:50 +01:00
parent de39d61937
commit 26c4fbef33

View File

@@ -774,20 +774,16 @@ fn run_c_compile(
if debug {
eprintln!(
"run_c_compile: stdout: {}\n\nstderr: {}",
std::str::from_utf8(&output.stdout)
.expect("stdout is not utf8! need to handle arbitrary bytes"),
std::str::from_utf8(&output.stderr)
.expect("stderr is not utf8! need to handle arbitrary bytes")
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
}
if !output.status.success() {
bail!(
"C code compile failed with: stdout: {}\n\nstderr: {}",
std::str::from_utf8(&output.stdout)
.expect("stdout is not utf8! need to handle arbitrary bytes"),
std::str::from_utf8(&output.stderr)
.expect("stderr is not utf8! need to handle arbitrary bytes")
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
}