From c01b1aec51ea7f7a63d7f1a8ea7b153ff4b9c7e1 Mon Sep 17 00:00:00 2001 From: Andrey Tcherepanov Date: Mon, 1 Apr 2019 10:15:09 -0600 Subject: [PATCH 1/2] Move files to main directory --- terminal/terminal_check_bsd.go => terminal_check_bsd.go | 0 terminal/terminal_check_unix.go => terminal_check_unix.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename terminal/terminal_check_bsd.go => terminal_check_bsd.go (100%) rename terminal/terminal_check_unix.go => terminal_check_unix.go (100%) diff --git a/terminal/terminal_check_bsd.go b/terminal_check_bsd.go similarity index 100% rename from terminal/terminal_check_bsd.go rename to terminal_check_bsd.go diff --git a/terminal/terminal_check_unix.go b/terminal_check_unix.go similarity index 100% rename from terminal/terminal_check_unix.go rename to terminal_check_unix.go From 003af98bf096fc7575feabaff2878e4e913c1ec1 Mon Sep 17 00:00:00 2001 From: Andrey Tcherepanov Date: Mon, 1 Apr 2019 10:16:11 -0600 Subject: [PATCH 2/2] Make isTerminal un-exported --- terminal_check_bsd.go | 4 ++-- terminal_check_notappengine.go | 4 +--- terminal_check_unix.go | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/terminal_check_bsd.go b/terminal_check_bsd.go index 6a47df6d4..3c4f43f91 100644 --- a/terminal_check_bsd.go +++ b/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 } diff --git a/terminal_check_notappengine.go b/terminal_check_notappengine.go index b61be8d55..7be2d87c5 100644 --- a/terminal_check_notappengine.go +++ b/terminal_check_notappengine.go @@ -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 } diff --git a/terminal_check_unix.go b/terminal_check_unix.go index f30ea8784..355dc966f 100644 --- a/terminal_check_unix.go +++ b/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 }