David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 1 | // +build solaris |
2 | // +build !appengine | ||||
3 | |||||
4 | package isatty | ||||
5 | |||||
6 | import ( | ||||
7 | "golang.org/x/sys/unix" | ||||
8 | ) | ||||
9 | |||||
10 | // IsTerminal returns true if the given file descriptor is a terminal. | ||||
11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c | ||||
12 | func IsTerminal(fd uintptr) bool { | ||||
13 | var termio unix.Termio | ||||
14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) | ||||
15 | return err == nil | ||||
16 | } |