Skip to content

Commit

Permalink
[backport] 🐛 Close analysis.log before generate static-report (#415) (#…
Browse files Browse the repository at this point in the history
…419)

🐛 Close analysis.log before generate static-report (#415)

* Close analysis.log before generate static-report

Related to containerless --bulk analysis on Windows. Remove of
analysis.log silently failed since it was still opened (which appears on
Windows), moving the file `Close()` from `defer` just before generating
static-report.

Fixes: https://issues.redhat.com/browse/MTA-4307



* Re-add Close in defer



---------

Signed-off-by: Marek Aufart <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>
  • Loading branch information
aufi authored Jan 24, 2025
1 parent d8366bd commit 6dd906f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/analyze-bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ func (a *analyzeCommand) RunAnalysisContainerless(ctx context.Context) error {
return err
}

// Ensure analysis log is closed before creating static-report (needed for bulk on Windows)
analysisLog.Close()

err = a.GenerateStaticReportContainerless(ctx)
if err != nil {
a.log.Error(err, "failed to generate static report")
Expand Down

0 comments on commit 6dd906f

Please sign in to comment.