From b005e2efaff6fd99dbf8e45bf76bba40c655a72a Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 9 May 2021 12:46:18 +0200 Subject: [PATCH] safcm: don't color output if stderr is redirected All log messages are printed to stderr. It's confusing to still get colored output when redirecting stderr to a file; only redirecting stdout as well fixed this. --- cmd/safcm/sync.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/safcm/sync.go b/cmd/safcm/sync.go index 6358f0c..54df9ec 100644 --- a/cmd/safcm/sync.go +++ b/cmd/safcm/sync.go @@ -122,7 +122,8 @@ func MainSync(args []string) error { return fmt.Errorf("no hosts found") } - isTTY := term.IsTerminal(int(os.Stdout.Fd())) + isTTY := term.IsTerminal(int(os.Stdout.Fd())) && + term.IsTerminal(int(os.Stderr.Fd())) done := make(chan bool) // Collect events from all hosts and print them -- 2.43.2