github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/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  }