From 8cdd4b39f502d10358d92586e020d3535f257ec9 Mon Sep 17 00:00:00 2001 From: 0xe0f Date: Tue, 3 Nov 2015 12:21:35 +0300 Subject: [PATCH] Added implementation of function "IsTerminal" for Solaris --- terminal_solaris.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 terminal_solaris.go diff --git a/terminal_solaris.go b/terminal_solaris.go new file mode 100644 index 0000000..3e70bf7 --- /dev/null +++ b/terminal_solaris.go @@ -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 +}