Skip to content

Commit

Permalink
fix linter errors and make sure runtimes are closed
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Feb 2, 2024
1 parent dbf9ab6 commit 4f06128
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ func discoverAssets(ctx context.Context, job *Job, upstream *upstream.UpstreamCo
discoveredAssets.AddError(resolvedRootAsset, err)
continue
}
rootRuntime.SetRecording(recording)
if err := rootRuntime.SetRecording(recording); err != nil {
discoveredAssets.AddError(resolvedRootAsset, err)
continue
}

if err := rootRuntime.Connect(&plugin.ConnectReq{
Features: cnquery.GetFeatures(ctx),
Expand All @@ -326,6 +329,11 @@ func discoverAssets(ctx context.Context, job *Job, upstream *upstream.UpstreamCo
discoveredAssets.AddError(a, err)
continue
}
if err := runtime.SetRecording(recording); err != nil {
discoveredAssets.AddError(resolvedRootAsset, err)
runtime.Close()
continue
}

err = runtime.Connect(&plugin.ConnectReq{
Features: config.Features,
Expand All @@ -334,6 +342,7 @@ func discoverAssets(ctx context.Context, job *Job, upstream *upstream.UpstreamCo
})
if err != nil {
discoveredAssets.AddError(a, err)
runtime.Close()
continue
}

Expand Down

0 comments on commit 4f06128

Please sign in to comment.