mirror of https://github.com/sirupsen/logrus.git
Added terminal check on Windows
This commit is contained in:
parent
7d2a5214bf
commit
c9a46a1e7c
|
@ -1,4 +1,4 @@
|
|||
// +build !appengine,!gopherjs
|
||||
// +build !appengine,!gopherjs,!windows
|
||||
|
||||
package logrus
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// +build !appengine,!gopherjs,windows
|
||||
|
||||
package logrus
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func checkIfTerminal(w io.Writer) bool {
|
||||
switch v := w.(type) {
|
||||
case *os.File:
|
||||
var mode uint32
|
||||
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
|
||||
return err == nil
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue