From: Ralf Jung Date: Fri, 14 Jun 2019 09:15:09 +0000 (+0200) Subject: change sysroot check to print the output in case of an error X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ac2f6cbcde00eebcb696143e76177c1600f63410;p=rust.git change sysroot check to print the output in case of an error --- diff --git a/src/bin/cargo-miri.rs b/src/bin/cargo-miri.rs index 121930bccce..3b7af932419 100644 --- a/src/bin/cargo-miri.rs +++ b/src/bin/cargo-miri.rs @@ -133,11 +133,12 @@ fn test_sysroot_consistency() { fn get_sysroot(mut cmd: Command) -> PathBuf { let out = cmd.arg("--print").arg("sysroot") .output().expect("Failed to run rustc to get sysroot info"); - assert!(out.status.success(), "Bad status code when getting sysroot info"); - let sysroot = out.stdout.lines().nth(0) - .expect("didn't get at least one line for the sysroot").unwrap(); - PathBuf::from(sysroot).canonicalize() - .expect("Failed to canonicalize sysroot") + let stdout = String::from_utf8(out.stdout).expect("stdout is not valid UTF-8"); + let stderr = String::from_utf8(out.stderr).expect("stderr is not valid UTF-8"); + let stdout = stdout.trim(); + assert!(out.status.success(), "Bad status code when getting sysroot info.\nstdout:\n{}\nstderr:\n{}", stdout, stderr); + PathBuf::from(stdout).canonicalize() + .unwrap_or_else(|_| panic!("Failed to canonicalize sysroot: {}", stdout)) } let rustc_sysroot = get_sysroot(Command::new("rustc"));