Skip to content

Commit af177ee

Browse files
committed
Fix TTY colors
The change from #13 actually disabled coloring when output device is a TTY device. Excerpt from BSD manual for `isatty`: ``` RETURN VALUES The isatty() function returns 1 if fd refers to a terminal type device; otherwise, it returns 0 and may set errno to indicate the error. ``` Double negative is hard. 🤦‍♀️ Anyways.
1 parent d493bd7 commit af177ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/FileCheck/Diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
func diagnose(_ kind : DiagnosticKind, at loc : CheckLocation, with message : String, options: FileCheckOptions) {
4-
let disableColors = options.contains(.disableColors) || isatty(fileno(stdout)) == 1
4+
let disableColors = options.contains(.disableColors) || isatty(fileno(stdout)) != 1
55
if disableColors {
66
print("\(kind): \(message)")
77
} else {

0 commit comments

Comments
 (0)