Skip to content

Actually pass through the request for --color=always #2245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cargo-miri/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,12 +952,14 @@ fn phase_runner(binary: &Path, binary_args: env::Args, phase: RunnerPhase) {
assert!(suffix.starts_with('='));
// Drop this argument.
} else if let Some(suffix) = arg.strip_prefix(json_flag) {
assert!(suffix.starts_with('='));
let suffix = suffix.strip_prefix('=').unwrap();
// 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") {
// First skip over the leading `=`, then check for diagnostic-rendered-ansi in the
// comma-separated list
if suffix.split(',').any(|a| a == "diagnostic-rendered-ansi") {
cmd.arg("--color=always");
}
// But aside from remembering that colored output was requested, drop this argument.
Expand Down