Skip to content

Commit 6e0e23c

Browse files
authored
spirv-builder: pass through non-JSON stdout lines even after an error. (EmbarkStudios#267)
1 parent 0581f85 commit 6e0e23c

File tree

1 file changed

+7
-2
lines changed
  • crates/spirv-builder/src

1 file changed

+7
-2
lines changed

crates/spirv-builder/src/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,14 @@ fn invoke_rustc(builder: &SpirvBuilder) -> Result<PathBuf, SpirvBuilderError> {
162162
.env("RUSTFLAGS", rustflags)
163163
.output()
164164
.expect("failed to execute cargo build");
165+
166+
// `get_last_artifact` has the side-effect of printing invalid lines, so
167+
// we do that even in case of an error, to let through any useful messages
168+
// that ended up on stdout instead of stderr.
169+
let stdout = String::from_utf8(build.stdout).unwrap();
170+
let artifact = get_last_artifact(&stdout);
171+
165172
if build.status.success() {
166-
let stdout = String::from_utf8(build.stdout).unwrap();
167-
let artifact = get_last_artifact(&stdout);
168173
if builder.print_metadata {
169174
print_deps_of(&artifact);
170175
}

0 commit comments

Comments
 (0)