From 3e06420226535b37c2ad9f55e41815c518a3f687 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 ede5b639cd53235df193ab3c501d122be5195b17 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 6a47df6..3c4f43f 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 b61be8d..7be2d87 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 f30ea87..355dc96 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 }