Skip to content

Commit

Permalink
Fix TTY colors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dduan committed Nov 26, 2019
1 parent d493bd7 commit af177ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/FileCheck/Diagnostics.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

func diagnose(_ kind : DiagnosticKind, at loc : CheckLocation, with message : String, options: FileCheckOptions) {
let disableColors = options.contains(.disableColors) || isatty(fileno(stdout)) == 1
let disableColors = options.contains(.disableColors) || isatty(fileno(stdout)) != 1
if disableColors {
print("\(kind): \(message)")
} else {
Expand Down

0 comments on commit af177ee

Please sign in to comment.