1
0
Fork 0
mirror of https://github.com/Luzifer/continuous-spark.git synced 2024-10-19 05:14:24 +00:00
continuous-spark/vendor/github.com/sirupsen/logrus/terminal_solaris.go
Knut Ahlers 164e4b60f5
Vendor dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-07-28 07:24:58 +02:00

21 lines
352 B
Go

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