Split terminal check to add build tags to support App Engine.

This commit is contained in:
Ernesto Alejo
2017-09-06 19:34:58 +02:00
parent 89742aefa4
commit 7d3ddc68a3
3 changed files with 31 additions and 14 deletions
+19
View File
@@ -0,0 +1,19 @@
// +build !appengine
package logrus
import (
"io"
"os"
"golang.org/x/crypto/ssh/terminal"
)
func checkIfTerminal(w io.Writer) bool {
switch v := w.(type) {
case *os.File:
return terminal.IsTerminal(int(v.Fd()))
default:
return false
}
}