Skip to content

Commit c9bdbb0

Browse files
authored
Merge pull request #1360 from snyk/fix/html-to-stdout
Use voidprinter when sending HTML output to stdout
2 parents 0547292 + 70bcd60 commit c9bdbb0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pkg/cmd/scan/output/output.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ func GetPrinter(config OutputConfig, quiet bool) output.Printer {
8989
return &output.VoidPrinter{}
9090
}
9191
fallthrough
92+
case HTMLOutputType:
93+
if isStdOut(config.Path) {
94+
return &output.VoidPrinter{}
95+
}
96+
fallthrough
9297
case ConsoleOutputType:
9398
fallthrough
9499
default:

pkg/cmd/scan/output/output_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,18 @@ func TestGetPrinter(t *testing.T) {
529529
key: PlanOutputType,
530530
want: &output.VoidPrinter{},
531531
},
532+
{
533+
name: "html stdout output",
534+
path: "stdout",
535+
key: HTMLOutputType,
536+
want: &output.VoidPrinter{},
537+
},
538+
{
539+
name: "html /dev/stdout output",
540+
path: "/dev/stdout",
541+
key: HTMLOutputType,
542+
want: &output.VoidPrinter{},
543+
},
532544
}
533545
for _, tt := range tests {
534546
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)