File tree 4 files changed +12
-24
lines changed 4 files changed +12
-24
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ module github.com/sirupsen/logrus
2
2
3
3
require (
4
4
github.com/davecgh/go-spew v1.1.1 // indirect
5
- github.com/konsorten/go-windows-terminal-sequences v1.0.3
6
5
github.com/pmezard/go-difflib v1.0.0 // indirect
7
6
github.com/stretchr/testify v1.2.2
8
7
golang.org/x/sys v0.0.0-20190422165155-953cdadca894
Original file line number Diff line number Diff line change 1
1
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
2
2
github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
3
- github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk =
4
- github.com/konsorten/go-windows-terminal-sequences v1.0.1 /go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ =
5
- github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8 =
6
- github.com/konsorten/go-windows-terminal-sequences v1.0.3 /go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ =
7
3
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
8
4
github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
9
5
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w =
Original file line number Diff line number Diff line change @@ -5,30 +5,23 @@ package logrus
5
5
import (
6
6
"io"
7
7
"os"
8
- "syscall"
9
8
10
- sequences "github.com/konsorten/go- windows-terminal-sequences "
9
+ "golang.org/x/sys/ windows"
11
10
)
12
11
13
- func initTerminal (w io.Writer ) {
14
- switch v := w .(type ) {
15
- case * os.File :
16
- sequences .EnableVirtualTerminalProcessing (syscall .Handle (v .Fd ()), true )
17
- }
18
- }
19
-
20
12
func checkIfTerminal (w io.Writer ) bool {
21
- var ret bool
22
13
switch v := w .(type ) {
23
14
case * os.File :
15
+ handle := windows .Handle (v .Fd ())
24
16
var mode uint32
25
- err := syscall .GetConsoleMode (syscall .Handle (v .Fd ()), & mode )
26
- ret = (err == nil )
27
- default :
28
- ret = false
29
- }
30
- if ret {
31
- initTerminal (w )
17
+ if err := windows .GetConsoleMode (handle , & mode ); err != nil {
18
+ return false
19
+ }
20
+ mode |= windows .ENABLE_VIRTUAL_TERMINAL_PROCESSING
21
+ if err := windows .SetConsoleMode (handle , mode ); err != nil {
22
+ return false
23
+ }
24
+ return true
32
25
}
33
- return ret
26
+ return false
34
27
}
Original file line number Diff line number Diff line change 18
18
19
19
if [[ " $GO111MODULE " == " off" ]]; then
20
20
# Should contain all regular (not indirect) modules from go.mod
21
- go get github.com/stretchr/testify golang.org/x/sys/unix github.com/konsorten/go- windows-terminal-sequences
21
+ go get github.com/stretchr/testify golang.org/x/sys/unix golang.org/x/sys/ windows
22
22
fi
You can’t perform that action at this time.
0 commit comments