本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
471B

  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. }
上海开阖软件有限公司 沪ICP备12045867号-1