github.com/mem/u-root@v2.0.1-0.20181004165302-9b18b4636a33+incompatible/cmds/elvish/sys/isatty_unix.go (about)

     1  // +build !windows,!plan9
     2  
     3  package sys
     4  
     5  import (
     6  	"os"
     7  	"github.com/u-root/u-root/pkg/termios"
     8  )
     9  
    10  // IsATTY returns true if the given file is a terminal.
    11  func IsATTY(file *os.File) bool {
    12  	_, err := termios.GetTermios(file.Fd())
    13  	return err == nil
    14  }