summaryrefslogblamecommitdiffstats
path: root/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
blob: 3c86b1abeeb19fcae94b5def7cfb80fab1e0ebe9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
                            


              
            




                                                                      






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