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
diff --git a/ui/terminal/util.go b/ui/terminal/util.go
index f383ef1..7a603d7 100644
--- a/ui/terminal/util.go
+++ b/ui/terminal/util.go
@@ -23,10 +23,10 @@
)
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)),