2021-09-08 00:10:46 +02:00
|
|
|
//go:build (linux || aix || zos) && !appengine
|
2021-06-09 02:45:52 +02:00
|
|
|
// +build linux aix zos
|
2019-10-30 00:47:56 +01:00
|
|
|
// +build !appengine
|
|
|
|
|
|
|
|
package isatty
|
|
|
|
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
|
|
|
|
// IsTerminal return true if the file descriptor is terminal.
|
|
|
|
func IsTerminal(fd uintptr) bool {
|
|
|
|
_, err := unix.IoctlGetTermios(int(fd), unix.TCGETS)
|
|
|
|
return err == nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
|
|
|
|
// terminal. This is also always false on this environment.
|
|
|
|
func IsCygwinTerminal(fd uintptr) bool {
|
|
|
|
return false
|
|
|
|
}
|