mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Check term supports colour before printing fancy diffs
For a terminal like DUMB, we were still attempting to print colourful diffs, which failed with a `NotSupported` error. Fixes #1140
This commit is contained in:
parent
59e199b439
commit
05882314f5
@ -89,7 +89,9 @@ pub fn print_diff<F>(diff: Vec<Mismatch>, get_section_title: F)
|
||||
where F: Fn(u32) -> String
|
||||
{
|
||||
match term::stdout() {
|
||||
Some(_) if isatty() => print_diff_fancy(diff, get_section_title, term::stdout().unwrap()),
|
||||
Some(ref t) if isatty() && t.supports_color() => {
|
||||
print_diff_fancy(diff, get_section_title, term::stdout().unwrap())
|
||||
}
|
||||
_ => print_diff_basic(diff, get_section_title),
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user