-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-error-codesArea: Explanation of an error code (--explain)Area: Explanation of an error code (--explain)C-bugCategory: This is a bug.Category: This is a bug.D-inconsistentDiagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Zulip discussion: #t-compiler > Rustc `--color always` doesn't always color output
While working on #150895, I discovered that some parts of rustc that use --color flag don't always output color when the flag is set to always.
Relevant Examples:
rust/compiler/rustc_driver_impl/src/lib.rs
Lines 494 to 498 in 4d38622
| if io::stdout().is_terminal() { | |
| show_md_content_with_pager(&text, color); | |
| } else { | |
| safe_print!("{text}"); | |
| } |
rust/src/tools/rustfmt/src/parse/session.rs
Lines 102 to 106 in 4d38622
| let emit_color = if supports_color { | |
| ColorConfig::from(color) | |
| } else { | |
| ColorConfig::Never | |
| }; |
The check for terminal support should only occur when the option is set to auto. There may be more examples for this as well. These are just the two that I could find.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-error-codesArea: Explanation of an error code (--explain)Area: Explanation of an error code (--explain)C-bugCategory: This is a bug.Category: This is a bug.D-inconsistentDiagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.