From e773b07dce66134a75879f8ba589a307eae53246 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 10 Jul 2020 17:11:30 +0100 Subject: [PATCH] lib/terminal: DEBUG which kind of terminal we are using FIXME DO NOT MERGE --- lib/terminal/terminal.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/terminal/terminal.go b/lib/terminal/terminal.go index 9a7c1ab7b..13d787c52 100644 --- a/lib/terminal/terminal.go +++ b/lib/terminal/terminal.go @@ -3,6 +3,7 @@ package terminal import ( + "fmt" "io" "os" "runtime" @@ -73,12 +74,15 @@ func Start() { once.Do(func() { f := os.Stdout if !terminal.IsTerminal(int(f.Fd())) { + fmt.Fprintf(os.Stderr, "terminal: removing escape codes - no tty detected\n") // If stdout not a tty then remove escape codes Out = colorable.NewNonColorable(f) } else if runtime.GOOS == "windows" && os.Getenv("TERM") != "" { + fmt.Fprintf(os.Stderr, "terminal: Windows with TERM using stdout directly\n") // If TERM is set just use stdout Out = f } else { + fmt.Fprintf(os.Stderr, "terminal: using OS specific code\n") Out = colorable.NewColorable(f) } })