Skip to content

Commit

Permalink
build.rs: print rustc stderr if exit status != 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jsha committed Apr 3, 2023
1 parent 68e06ad commit 52808ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::env;
use std::process::Command;
use std::str;
use std::string::String;

// List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we
// need to know all the possible cfgs that this script will set. If you need to set another cfg
Expand Down Expand Up @@ -181,6 +182,13 @@ fn rustc_minor_nightly() -> (u32, bool) {
.output()
.ok()
.expect("Failed to get rustc version");
if !output.status.success() {
panic!(
"failed to run rustc: {}",
String::from_utf8_lossy(output.stderr.as_slice())
);
}

let version = otry!(str::from_utf8(&output.stdout).ok());
let mut pieces = version.split('.');

Expand Down

0 comments on commit 52808ce

Please sign in to comment.