Skip to content

Commit

Permalink
fix: disable color output if we're not being called from a terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 2, 2024
1 parent 6984d31 commit 443a202
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/reporter/vertical_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/google/osv-scanner/internal/output"
"github.com/google/osv-scanner/pkg/models"
"github.com/jedib0t/go-pretty/v6/text"
)

type VerticalReporter struct {
Expand Down Expand Up @@ -62,6 +63,10 @@ func (r *VerticalReporter) PrintResult(vulnResult *models.VulnerabilityResults)
return nil
}

if r.terminalWidth <= 0 {
text.DisableColors()
}

output.PrintVerticalResults(vulnResult, r.stdout)

return nil
Expand Down

0 comments on commit 443a202

Please sign in to comment.