Skip to content

Commit

Permalink
Auto merge of rust-lang#2243 - saethlin:color-always, r=oli-obk
Browse files Browse the repository at this point in the history
Pass --color=always through cargo-miri

Closes rust-lang/miri#2037

I just implemented the fix suggested in that issue and it seems to work without issue.
  • Loading branch information
bors committed Jun 20, 2022
2 parents fe04faf + 6cd74ee commit b2616ce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cargo-miri/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,14 @@ fn phase_runner(binary: &Path, binary_args: env::Args, phase: RunnerPhase) {
// Drop this argument.
} else if let Some(suffix) = arg.strip_prefix(json_flag) {
assert!(suffix.starts_with('='));
// Drop this argument.
// This is how we pass through --color=always. We detect that Cargo is detecting rustc
// to emit the diagnostic structure that Cargo would consume from rustc to emit colored
// diagnostics, and ask rustc to emit them.
// See https://github.com/rust-lang/miri/issues/2037
if arg.split(',').any(|a| a == "diagnostic-rendered-ansi") {
cmd.arg("--color=always");
}
// But aside from remembering that colored output was requested, drop this argument.
} else {
cmd.arg(arg);
}
Expand Down

0 comments on commit b2616ce

Please sign in to comment.