diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-17 20:23:14 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-17 20:23:14 +0200 |
commit | 1332a6ec0a00b2475bc2b7b35b4c61425361d6b6 (patch) | |
tree | ff9ee93ea4a3bafc99d049d4f0c7b9f199ff0fec /vendor/github.com/mattn/go-isatty/isatty_bsd.go | |
parent | 9e6c687fca71103fd7550e25c471b9f805337b09 (diff) | |
download | git-bug-1332a6ec0a00b2475bc2b7b35b4c61425361d6b6.tar.gz |
ls: add some colors
Diffstat (limited to 'vendor/github.com/mattn/go-isatty/isatty_bsd.go')
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_bsd.go | 18 |
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 00000000..42f2514d --- /dev/null +++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go @@ -0,0 +1,18 @@ +// +build darwin freebsd openbsd netbsd dragonfly +// +build !appengine + +package isatty + +import ( + "syscall" + "unsafe" +) + +const ioctlReadTermios = syscall.TIOCGETA + +// IsTerminal return true if the file descriptor is terminal. +func IsTerminal(fd uintptr) bool { + var termios syscall.Termios + _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) + return err == 0 +} |