logrus/terminal/terminal_check_unix.go

14 lines
216 B
Go

// +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
}