另客网go项目公用的代码库

isatty_linux.go 471B

1234567891011121314151617181920
  1. // +build linux
  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. }