Skip to content

Commit

Permalink
🐛 Close analysis.log before generate static-report (#415)
Browse files Browse the repository at this point in the history
* 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

Signed-off-by: Marek Aufart <[email protected]>

* Re-add Close in defer

Signed-off-by: Marek Aufart <[email protected]>

---------

Signed-off-by: Marek Aufart <[email protected]>
  • Loading branch information
aufi authored Jan 23, 2025
1 parent f286d34 commit 58bea81
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 58bea81

Please sign in to comment.