mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 04:11:03 +00:00
4df9c8d6a5
* github.com/russross/meddler v1.0.0 -> v1.0.1 * github.com/gin-gonic/gin v1.6.3 -> v1.7.4 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/sirupsen/logrus v1.6.0 -> v1.8.1 * github.com/rs/zerolog v1.18.0 -> v1.25.0
27 lines
490 B
Go
27 lines
490 B
Go
// +build !appengine,!js,windows
|
|
|
|
package logrus
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func checkIfTerminal(w io.Writer) bool {
|
|
switch v := w.(type) {
|
|
case *os.File:
|
|
handle := windows.Handle(v.Fd())
|
|
var mode uint32
|
|
if err := windows.GetConsoleMode(handle, &mode); err != nil {
|
|
return false
|
|
}
|
|
mode |= windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
|
if err := windows.SetConsoleMode(handle, mode); err != nil {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
return false
|
|
}
|