File: isatty_solaris.go

package info (click to toggle)
golang-github-mattn-go-isatty 0.0.7+really0.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports, buster-proposed-updates, experimental
  • size: 112 kB
  • sloc: makefile: 2
file content (16 lines) | stat: -rw-r--r-- 402 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// +build solaris
// +build !appengine

package isatty

import (
	"golang.org/x/sys/unix"
)

// IsTerminal returns true if the given file descriptor is a terminal.
// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
func IsTerminal(fd uintptr) bool {
	var termio unix.Termio
	err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
	return err == nil
}