Disable color if the output stream is not a terminal; Fixes #4

This commit is contained in:
Paul deGrandis 2016-02-22 08:44:23 -05:00
parent a9197527a2
commit 5772eba1cb

20
mk.go
View file

@ -1,19 +1,21 @@
package main package main
import ( import (
"bufio" "bufio"
"runtime" "runtime"
"flag" "flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"sync" "sync"
"github.com/mattn/go-isatty"
) )
// True if messages should be printed without fancy colors. // True if messages should be printed without fancy colors.
var nocolor bool = false // - By default, if the output stream is not the terminal, colors are disabled
var nocolor bool = !isatty.IsTerminal(os.Stdout.Fd())
// True if we are ignoring timestamps and rebuilding everything. // True if we are ignoring timestamps and rebuilding everything.
var rebuildall bool = false var rebuildall bool = false