From 9d42425f25b30c67b51b8c33751f2960b15a910d Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 2 Jul 2019 09:51:42 -0700 Subject: [PATCH] Perform TERM check for file writers only Tests use fakeSmartTerminal, this case must not be affected by the TERM setting. Test: TERM=dumb make Change-Id: Ib926a1c6ba2d8c4117d412fe351d872ccfc1c799 --- ui/terminal/util.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/terminal/util.go b/ui/terminal/util.go index f383ef19e..7a603d7f7 100644 --- a/ui/terminal/util.go +++ b/ui/terminal/util.go @@ -23,10 +23,10 @@ import ( ) func isSmartTerminal(w io.Writer) bool { - if term, ok := os.LookupEnv("TERM"); ok && term == "dumb" { - return false - } if f, ok := w.(*os.File); ok { + if term, ok := os.LookupEnv("TERM"); ok && term == "dumb" { + return false + } var termios syscall.Termios _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, f.Fd(), ioctlGetTermios, uintptr(unsafe.Pointer(&termios)),