1
Fork 0

adjust miri sysroot determination

This commit is contained in:
Ralf Jung 2019-10-19 17:17:02 +02:00
parent f704c099eb
commit 5192daf43e

View file

@ -427,7 +427,7 @@ impl Step for Miri {
// (We do this separately from the above so that when the setup actually // (We do this separately from the above so that when the setup actually
// happens we get some output.) // happens we get some output.)
// We re-use the `cargo` from above. // We re-use the `cargo` from above.
cargo.arg("--env"); cargo.arg("--print-sysroot");
// FIXME: Is there a way in which we can re-use the usual `run` helpers? // FIXME: Is there a way in which we can re-use the usual `run` helpers?
let miri_sysroot = if builder.config.dry_run { let miri_sysroot = if builder.config.dry_run {
@ -437,13 +437,11 @@ impl Step for Miri {
let out = cargo.output() let out = cargo.output()
.expect("We already ran `cargo miri setup` before and that worked"); .expect("We already ran `cargo miri setup` before and that worked");
assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code"); assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code");
// Output is "MIRI_SYSROOT=<str>\n". // Output is "<sysroot>\n".
let stdout = String::from_utf8(out.stdout) let stdout = String::from_utf8(out.stdout)
.expect("`cargo miri setup` stdout is not valid UTF-8"); .expect("`cargo miri setup` stdout is not valid UTF-8");
let stdout = stdout.trim(); let sysroot = stdout.trim_end();
builder.verbose(&format!("`cargo miri setup --env` returned: {:?}", stdout)); builder.verbose(&format!("`cargo miri setup --print-sysroot` said: {:?}", sysroot));
let sysroot = stdout.splitn(2, '=')
.nth(1).expect("`cargo miri setup` stdout did not contain '='");
sysroot.to_owned() sysroot.to_owned()
}; };