本站源代码
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.

24 lines
564B

  1. // +build android
  2. package isatty
  3. import (
  4. "syscall"
  5. "unsafe"
  6. )
  7. const ioctlReadTermios = syscall.TCGETS
  8. // IsTerminal return true if the file descriptor is terminal.
  9. func IsTerminal(fd uintptr) bool {
  10. var termios syscall.Termios
  11. _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
  12. return err == 0
  13. }
  14. // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
  15. // terminal. This is also always false on this environment.
  16. func IsCygwinTerminal(fd uintptr) bool {
  17. return false
  18. }
上海开阖软件有限公司 沪ICP备12045867号-1