Skip to content

Commit

Permalink
spirv-builder: pass through non-JSON stdout lines even after an error. (
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Nov 20, 2020
1 parent 0581f85 commit 6e0e23c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/spirv-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,14 @@ fn invoke_rustc(builder: &SpirvBuilder) -> Result<PathBuf, SpirvBuilderError> {
.env("RUSTFLAGS", rustflags)
.output()
.expect("failed to execute cargo build");

// `get_last_artifact` has the side-effect of printing invalid lines, so
// we do that even in case of an error, to let through any useful messages
// that ended up on stdout instead of stderr.
let stdout = String::from_utf8(build.stdout).unwrap();
let artifact = get_last_artifact(&stdout);

if build.status.success() {
let stdout = String::from_utf8(build.stdout).unwrap();
let artifact = get_last_artifact(&stdout);
if builder.print_metadata {
print_deps_of(&artifact);
}
Expand Down

0 comments on commit 6e0e23c

Please sign in to comment.