Added FreeBSD support
This commit is contained in:
parent
77b109b517
commit
cb8aacf9b8
4 changed files with 14 additions and 0 deletions
11
tty/Terminal_bsd.go
Normal file
11
tty/Terminal_bsd.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
//go:build darwin || freebsd
|
||||
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue