另客网go项目公用的代码库

terminal_check_notappengine.go 270B

1234567891011121314151617181920
  1. // +build !appengine,!js,!windows,!aix
  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. }