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
This commit is contained in:
Mikhail Naganov 2019-07-02 09:51:42 -07:00
parent aebc02ab29
commit 9d42425f25

View file

@ -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)),