tlog: only enable color if both stderr and stdout are a terminal
This gocryptfs -init /does/not/exist 2> err.log used to write escape codes into err.log. Stop doing that.
This commit is contained in:
parent
a1f01419e2
commit
eb42e54182
@ -108,7 +108,9 @@ var Fatal *toggledLogger
|
||||
func init() {
|
||||
// Enable color output if we are connected to a terminal and NO_COLOR is
|
||||
// unset ( https://no-color.org/ ).
|
||||
if _, nocolor := os.LookupEnv("NO_COLOR"); !nocolor && term.IsTerminal(int(os.Stdout.Fd())) {
|
||||
if _, nocolor := os.LookupEnv("NO_COLOR"); !nocolor &&
|
||||
term.IsTerminal(int(os.Stdout.Fd())) &&
|
||||
term.IsTerminal(int(os.Stderr.Fd())) {
|
||||
ColorReset = "\033[0m"
|
||||
ColorGrey = "\033[2m"
|
||||
ColorRed = "\033[31m"
|
||||
|
Loading…
Reference in New Issue
Block a user