| David K. Bainbridge | 528b318 | 2017-01-23 08:51:59 -0800 | [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 | } | ||||