Skip to content

Commit

Permalink
Fix ANSI character output regression on Windows
Browse files Browse the repository at this point in the history
Fixes #5377
  • Loading branch information
LorenzCK authored and bep committed Nov 2, 2018
1 parent 0bc4b02 commit b8725f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions common/terminal/colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package terminal
import (
"fmt"
"os"
"runtime"
"strings"

isatty "github.com/mattn/go-isatty"
Expand All @@ -31,6 +32,10 @@ const (
// IsTerminal return true if the file descriptor is terminal and the TERM
// environment variable isn't a dumb one.
func IsTerminal(f *os.File) bool {
if runtime.GOOS == "windows" {
return false
}

fd := f.Fd()
return os.Getenv("TERM") != "dumb" && (isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd))
}
Expand Down

0 comments on commit b8725f5

Please sign in to comment.