terminal_check_bsd.go 259 B

12345678910111213
  1. // +build darwin dragonfly freebsd netbsd openbsd
  2. // +build !js
  3. package logrus
  4. import "golang.org/x/sys/unix"
  5. const ioctlReadTermios = unix.TIOCGETA
  6. func isTerminal(fd int) bool {
  7. _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
  8. return err == nil
  9. }