mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
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 <will.murphy@anchore.com>
This commit is contained in:
parent
3aae316456
commit
4fb9970481
@ -21,7 +21,7 @@ import (
|
|||||||
func Select(verbose, quiet bool) (uis []clio.UI) {
|
func Select(verbose, quiet bool) (uis []clio.UI) {
|
||||||
isStdoutATty := term.IsTerminal(int(os.Stdout.Fd()))
|
isStdoutATty := term.IsTerminal(int(os.Stdout.Fd()))
|
||||||
isStderrATty := term.IsTerminal(int(os.Stderr.Fd()))
|
isStderrATty := term.IsTerminal(int(os.Stderr.Fd()))
|
||||||
notATerminal := !isStderrATty && !isStdoutATty
|
notATerminal := !isStderrATty || !isStdoutATty
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case runtime.GOOS == "windows" || verbose || quiet || notATerminal || !isStderrATty:
|
case runtime.GOOS == "windows" || verbose || quiet || notATerminal || !isStderrATty:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user