Skip to content

Commit

Permalink
Merge pull request #943 from tandr/unexport-isterminal
Browse files Browse the repository at this point in the history
Unexport IsTerminal
  • Loading branch information
dgsb authored Apr 2, 2019
2 parents a6c0064 + ede5b63 commit 8fe117b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions terminal/terminal_check_bsd.go → terminal_check_bsd.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// +build darwin dragonfly freebsd netbsd openbsd

package terminal
package logrus

import "golang.org/x/sys/unix"

const ioctlReadTermios = unix.TIOCGETA

func IsTerminal(fd int) bool {
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}
Expand Down
4 changes: 1 addition & 3 deletions terminal_check_notappengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ package logrus
import (
"io"
"os"

"github.com/sirupsen/logrus/terminal"
)

func checkIfTerminal(w io.Writer) bool {
switch v := w.(type) {
case *os.File:
return terminal.IsTerminal(int(v.Fd()))
return isTerminal(int(v.Fd()))
default:
return false
}
Expand Down
4 changes: 2 additions & 2 deletions terminal/terminal_check_unix.go → terminal_check_unix.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// +build linux aix

package terminal
package logrus

import "golang.org/x/sys/unix"

const ioctlReadTermios = unix.TCGETS

func IsTerminal(fd int) bool {
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}
Expand Down

0 comments on commit 8fe117b

Please sign in to comment.