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
import (
"bufio"
"bufio"
"runtime"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
"github.com/mattn/go-isatty"
)
// 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.
var rebuildall bool = false