Skip to content

Commit 7865057

Browse files
committed
internal/debug: support color terminal for cygwin/msys2 (ethereum#17740)
1 parent 49e889e commit 7865057

File tree

11 files changed

+2
-150
lines changed

11 files changed

+2
-150
lines changed

internal/debug/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import (
2525
"runtime"
2626

2727
"github.com/XinFinOrg/XDPoSChain/log"
28-
"github.com/XinFinOrg/XDPoSChain/log/term"
2928
"github.com/XinFinOrg/XDPoSChain/metrics"
3029
"github.com/XinFinOrg/XDPoSChain/metrics/exp"
3130
colorable "github.com/mattn/go-colorable"
31+
"github.com/mattn/go-isatty"
3232
"gopkg.in/urfave/cli.v1"
3333
)
3434

@@ -113,7 +113,7 @@ var Flags = []cli.Flag{
113113
var Glogger *log.GlogHandler
114114

115115
func init() {
116-
usecolor := term.IsTty(os.Stderr.Fd()) && os.Getenv("TERM") != "dumb"
116+
usecolor := (isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())) && os.Getenv("TERM") != "dumb"
117117
output := io.Writer(os.Stderr)
118118
if usecolor {
119119
output = colorable.NewColorableStderr()

log/term/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

log/term/terminal_appengine.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

log/term/terminal_darwin.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

log/term/terminal_freebsd.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

log/term/terminal_linux.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

log/term/terminal_netbsd.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

log/term/terminal_notwindows.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

log/term/terminal_openbsd.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

log/term/terminal_solaris.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)