aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/mattn/go-isatty/isatty_bsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattn/go-isatty/isatty_bsd.go')
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_bsd.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
new file mode 100644
index 0000000..42f2514
--- /dev/null
+++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
@@ -0,0 +1,18 @@
1// +build darwin freebsd openbsd netbsd dragonfly
2// +build !appengine
3
4package isatty
5
6import (
7 "syscall"
8 "unsafe"
9)
10
11const ioctlReadTermios = syscall.TIOCGETA
12
13// IsTerminal return true if the file descriptor is terminal.
14func IsTerminal(fd uintptr) bool {
15 var termios syscall.Termios
16 _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
17 return err == 0
18}