github.com/jxskiss/gopkg/v2@v2.14.9-0.20240514120614-899f3e7952b4/zlog/internal/terminal/terminal_check_bsd.go (about) 1 //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && !js 2 3 package terminal 4 5 import "golang.org/x/sys/unix" 6 7 const ioctlReadTermios = unix.TIOCGETA 8 9 func isTerminal(fd int) bool { 10 _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) 11 return err == nil 12 }