Added implementation of function "IsTerminal" for Solaris

This commit is contained in:
0xe0f 2015-11-03 12:21:35 +03:00
parent fe6f2b0312
commit 8cdd4b39f5
1 changed files with 15 additions and 0 deletions

15
terminal_solaris.go Normal file
View File

@ -0,0 +1,15 @@
// +build solaris
package logrus
import (
"os"
"golang.org/x/sys/unix"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal() bool {
_, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA)
return err == nil
}