Moved moved unix-related parts into terminal

This commit is contained in:
Andrey Tcherepanov
2019-03-26 14:53:49 -06:00
parent 7de3dd8c8b
commit 41ee4dd365
6 changed files with 28 additions and 27 deletions
+13
View File
@@ -0,0 +1,13 @@
// +build darwin dragonfly freebsd netbsd openbsd
package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TIOCGETA
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}
+13
View File
@@ -0,0 +1,13 @@
// +build linux aix
package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TCGETS
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}