Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6c0398d

Browse files
committed
don't dump xargo output onto users of 'cargo miri test'
1 parent b08e51d commit 6c0398d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

cargo-miri/bin.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,24 @@ path = "lib.rs"
497497
// Disable debug assertions in the standard library -- Miri is already slow enough.
498498
// But keep the overflow checks, they are cheap.
499499
command.env("RUSTFLAGS", "-Cdebug-assertions=off -Coverflow-checks=on");
500+
// Manage the output the user sees.
501+
if only_setup {
502+
eprintln!("Preparing a sysroot for Miri...");
503+
} else {
504+
eprint!("Preparing a sysroot for Miri... ");
505+
command.stdout(process::Stdio::null());
506+
command.stderr(process::Stdio::null());
507+
}
500508
// Finally run it!
501509
if command.status().expect("failed to run xargo").success().not() {
502-
show_error(format!("failed to run xargo"));
510+
if only_setup {
511+
show_error(format!("failed to run xargo, see error details above"))
512+
} else {
513+
show_error(format!("failed to run xargo; run `cargo miri setup` to see the error details"))
514+
}
515+
}
516+
if !only_setup {
517+
eprintln!("done");
503518
}
504519

505520
// That should be it! But we need to figure out where xargo built stuff.
@@ -510,10 +525,10 @@ path = "lib.rs"
510525
// Figure out what to print.
511526
let print_sysroot = only_setup && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path
512527
if print_sysroot {
513-
// Print just the sysroot and nothing else; this way we do not need any escaping.
528+
// Print just the sysroot and nothing else to stdout; this way we do not need any escaping.
514529
println!("{}", sysroot.display());
515530
} else if only_setup {
516-
println!("A libstd for Miri is now available in `{}`.", sysroot.display());
531+
eprintln!("A sysroot for Miri is now available in `{}`.", sysroot.display());
517532
}
518533
}
519534

0 commit comments

Comments
 (0)