Skip to content

Commit

Permalink
Make isTerminal un-exported
Browse files Browse the repository at this point in the history
  • Loading branch information
tandr committed Apr 1, 2019
1 parent c01b1ae commit 003af98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions 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_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 003af98

Please sign in to comment.