logrus/terminal_check_windows.go

21 lines
297 B
Go
Raw Permalink Normal View History

2018-09-16 11:14:59 +03:00
// +build !appengine,!js,windows
2018-04-03 05:40:58 +03:00
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
}
}