Skip to content

Commit

Permalink
Merge pull request sirupsen#969 from sirupsen/plan9_build
Browse files Browse the repository at this point in the history
fix build break for plan9
  • Loading branch information
dgsb committed May 18, 2019
2 parents b29bb2c + 0a688f9 commit e65823d
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 46 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
11 changes: 0 additions & 11 deletions terminal_check_nacl.go

This file was deleted.

2 changes: 1 addition & 1 deletion terminal_check_js.go → terminal_check_no_terminal.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build js
// +build js nacl plan9

package logrus

Expand Down
2 changes: 1 addition & 1 deletion terminal_check_notappengine.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !appengine,!js,!windows,!nacl
// +build !appengine,!js,!windows,!nacl,!plan9

package logrus

Expand Down
18 changes: 16 additions & 2 deletions terminal_check_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,29 @@ import (
"io"
"os"
"syscall"

sequences "github.com/konsorten/go-windows-terminal-sequences"
)

func initTerminal(w io.Writer) {
switch v := w.(type) {
case *os.File:
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
}
}

func checkIfTerminal(w io.Writer) bool {
var ret bool
switch v := w.(type) {
case *os.File:
var mode uint32
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
return err == nil
ret = (err == nil)
default:
return false
ret = false
}
if ret {
initTerminal(w)
}
return ret
}
8 changes: 0 additions & 8 deletions terminal_notwindows.go

This file was deleted.

18 changes: 0 additions & 18 deletions terminal_windows.go

This file was deleted.

4 changes: 0 additions & 4 deletions text_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ type TextFormatter struct {
func (f *TextFormatter) init(entry *Entry) {
if entry.Logger != nil {
f.isTerminal = checkIfTerminal(entry.Logger.Out)

if f.isTerminal {
initTerminal(entry.Logger.Out)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion travis/cross_build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

if [[ "$TRAVIS_GO_VERSION" =~ ^1.\12\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
/tmp/gox/gox -build-lib -all -os '!plan9 !nacl'
/tmp/gox/gox -build-lib -all
fi

0 comments on commit e65823d

Please sign in to comment.