Skip to content

Commit 52808ce

Browse files
committed
build.rs: print rustc stderr if exit status != 0
1 parent 68e06ad commit 52808ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::env;
22
use std::process::Command;
33
use std::str;
4+
use std::string::String;
45

56
// List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we
67
// need to know all the possible cfgs that this script will set. If you need to set another cfg
@@ -181,6 +182,13 @@ fn rustc_minor_nightly() -> (u32, bool) {
181182
.output()
182183
.ok()
183184
.expect("Failed to get rustc version");
185+
if !output.status.success() {
186+
panic!(
187+
"failed to run rustc: {}",
188+
String::from_utf8_lossy(output.stderr.as_slice())
189+
);
190+
}
191+
184192
let version = otry!(str::from_utf8(&output.stdout).ok());
185193
let mut pieces = version.split('.');
186194

0 commit comments

Comments
 (0)