terminal_solaris.go 273 B

12345678910111213141516
  1. // +build solaris,!appengine
  2. package logrus
  3. import (
  4. "os"
  5. "golang.org/x/sys/unix"
  6. )
  7. // IsTerminal returns true if the given file descriptor is a terminal.
  8. func IsTerminal() bool {
  9. _, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA)
  10. return err == nil
  11. }