From 4fb9970481258d6b8819573a929610ce96082e6b Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Sat, 29 Jul 2023 13:36:27 -0400 Subject: [PATCH] Prevent hang if stderr is tty but stdout is not Previously, the rich TUI would be enabled if either stderr or stdout is a TTY, but this could cause syft to hang if stderr was a TTY and stdout was not, as in some cases of redirection. Signed-off-by: Will Murphy --- cmd/syft/internal/ui/select.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/syft/internal/ui/select.go b/cmd/syft/internal/ui/select.go index 27b536192..bb56a37fe 100644 --- a/cmd/syft/internal/ui/select.go +++ b/cmd/syft/internal/ui/select.go @@ -21,7 +21,7 @@ import ( func Select(verbose, quiet bool) (uis []clio.UI) { isStdoutATty := term.IsTerminal(int(os.Stdout.Fd())) isStderrATty := term.IsTerminal(int(os.Stderr.Fd())) - notATerminal := !isStderrATty && !isStdoutATty + notATerminal := !isStderrATty || !isStdoutATty switch { case runtime.GOOS == "windows" || verbose || quiet || notATerminal || !isStderrATty: