validtoml/vendor/github.com/andrew-d/go-termutil/isatty_nix.go
2018-01-08 01:30:28 +01:00

21 lines
343 B
Go

// +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
}