1
0
mirror of https://github.com/drone/drone-cli.git synced 2026-02-03 16:53:36 +01:00
drone-cli/vendor/github.com/mattn/go-isatty/isatty_linux.go
2015-10-24 17:06:46 -07:00

18 lines
368 B
Go

// +build linux
package isatty
import (
"syscall"
"unsafe"
)
const ioctlReadTermios = syscall.TCGETS
// 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
}