From: Simon Ruderich Date: Sun, 9 May 2021 10:46:18 +0000 (+0200) Subject: safcm: don't color output if stderr is redirected X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=b005e2efaff6fd99dbf8e45bf76bba40c655a72a;p=safcm%2Fsafcm.git 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. --- 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