isatty_bsd.go raw
1 //go:build (darwin || freebsd || openbsd || netbsd || dragonfly || hurd) && !appengine && !tinygo
2 // +build darwin freebsd openbsd netbsd dragonfly hurd
3 // +build !appengine
4 // +build !tinygo
5
6 package isatty
7
8 import "golang.org/x/sys/unix"
9
10 // IsTerminal return true if the file descriptor is terminal.
11 func IsTerminal(fd uintptr) bool {
12 _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
13 return err == nil
14 }
15
16 // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
17 // terminal. This is also always false on this environment.
18 func IsCygwinTerminal(fd uintptr) bool {
19 return false
20 }
21