changeset 251 | 1c52a0eeb952 |
parent 250 | c040f992052f |
child 252 | 8399cd48111b |
250:c040f992052f | 251:1c52a0eeb952 |
---|---|
1 // +build linux |
|
2 // +build ppc64 ppc64le |
|
3 |
|
4 package isatty |
|
5 |
|
6 import ( |
|
7 "unsafe" |
|
8 |
|
9 syscall "golang.org/x/sys/unix" |
|
10 ) |
|
11 |
|
12 const ioctlReadTermios = syscall.TCGETS |
|
13 |
|
14 // IsTerminal return true if the file descriptor is terminal. |
|
15 func IsTerminal(fd uintptr) bool { |
|
16 var termios syscall.Termios |
|
17 _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) |
|
18 return err == 0 |
|
19 } |