isatty_tcgets.go 456 B

123456789101112131415161718
  1. // +build linux aix
  2. // +build !appengine
  3. package isatty
  4. import "golang.org/x/sys/unix"
  5. // IsTerminal return true if the file descriptor is terminal.
  6. func IsTerminal(fd uintptr) bool {
  7. _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS)
  8. return err == nil
  9. }
  10. // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
  11. // terminal. This is also always false on this environment.
  12. func IsCygwinTerminal(fd uintptr) bool {
  13. return false
  14. }