fix: use voidprinter for html output

We should not print anything but the scan output when we send output to stdout.
main
sundowndev 2022-02-28 11:48:14 +04:00
parent 0547292e67
commit 70bcd60fbd
2 changed files with 17 additions and 0 deletions

View File

@ -89,6 +89,11 @@ func GetPrinter(config OutputConfig, quiet bool) output.Printer {
return &output.VoidPrinter{}
}
fallthrough
case HTMLOutputType:
if isStdOut(config.Path) {
return &output.VoidPrinter{}
}
fallthrough
case ConsoleOutputType:
fallthrough
default:

View File

@ -529,6 +529,18 @@ func TestGetPrinter(t *testing.T) {
key: PlanOutputType,
want: &output.VoidPrinter{},
},
{
name: "html stdout output",
path: "stdout",
key: HTMLOutputType,
want: &output.VoidPrinter{},
},
{
name: "html /dev/stdout output",
path: "/dev/stdout",
key: HTMLOutputType,
want: &output.VoidPrinter{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {