Skip to content

Commit 35624c5

Browse files
authored
Merge pull request #1142 from kamalmarhubi/fix-1140
Check term supports colour before printing fancy diffs
2 parents 59e199b + 0588231 commit 35624c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rustfmt_diff.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ pub fn print_diff<F>(diff: Vec<Mismatch>, get_section_title: F)
8989
where F: Fn(u32) -> String
9090
{
9191
match term::stdout() {
92-
Some(_) if isatty() => print_diff_fancy(diff, get_section_title, term::stdout().unwrap()),
92+
Some(ref t) if isatty() && t.supports_color() => {
93+
print_diff_fancy(diff, get_section_title, term::stdout().unwrap())
94+
}
9395
_ => print_diff_basic(diff, get_section_title),
9496
}
9597

0 commit comments

Comments
 (0)