isatty_tcgets.go 527 B

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