Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexport IsTerminal #943

Merged
merged 2 commits into from Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions terminal/terminal_check_bsd.go → terminal_check_bsd.go
@@ -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
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
@@ -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