isatty_tcgets.go 475 B

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