10 lines
222 B
Go
10 lines
222 B
Go
package tty
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
// IsTerminal returns true if the file descriptor is a terminal.
|
|
func IsTerminal(fd uintptr) bool {
|
|
_, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
|
|
return err == nil
|
|
}
|