orbiter/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
Gianluca Arbezzano 747f564a7a First commit
2017-02-21 00:07:57 +00:00

22 lines
367 B
Go

// +build solaris,!appengine
package logrus
import (
"os"
"golang.org/x/sys/unix"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(f io.Writer) bool {
var termios Termios
switch v := f.(type) {
case *os.File:
_, err := unix.IoctlGetTermios(int(v.Fd()), unix.TCGETA)
return err == nil
default:
return false
}
}