terminal_check_notappengine.go 265 B

12345678910111213141516171819
  1. // +build !appengine,!js,!windows
  2. package logrus
  3. import (
  4. "io"
  5. "os"
  6. "golang.org/x/crypto/ssh/terminal"
  7. )
  8. func checkIfTerminal(w io.Writer) bool {
  9. switch v := w.(type) {
  10. case *os.File:
  11. return terminal.IsTerminal(int(v.Fd()))
  12. default:
  13. return false
  14. }
  15. }