validtoml/vendor/github.com/andrew-d/go-termutil/isatty_nix.go

21 lines
343 B
Go
Raw Normal View History

2018-01-08 00:30:28 +00:00
// +build linux darwin freebsd
package termutil
import (
"syscall"
"unsafe"
)
func Isatty(fd uintptr) bool {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd,
uintptr(ioctlReadTermios),
uintptr(unsafe.Pointer(&termios)),
0,
0,
0)
return err == 0
}