gitlab.com/apertussolutions/u-root@v7.0.0+incompatible/cmds/core/elvish/sys/isatty_unix.go (about)

     1  // +build !windows,!plan9
     2  
     3  package sys
     4  
     5  import (
     6  	"github.com/u-root/u-root/pkg/termios"
     7  	"os"
     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  }