terminal_check_bsd.go 246 B

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