isatty_plan9.go 509 B

1234567891011121314151617181920212223
  1. //go:build plan9
  2. // +build plan9
  3. package isatty
  4. import (
  5. "syscall"
  6. )
  7. // IsTerminal returns true if the given file descriptor is a terminal.
  8. func IsTerminal(fd uintptr) bool {
  9. path, err := syscall.Fd2path(int(fd))
  10. if err != nil {
  11. return false
  12. }
  13. return path == "/dev/cons" || path == "/mnt/term/dev/cons"
  14. }
  15. // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
  16. // terminal. This is also always false on this environment.
  17. func IsCygwinTerminal(fd uintptr) bool {
  18. return false
  19. }