Skip to content

scan: Return an error instead of os.Exit(1) #2065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

jonjohnsonjr
Copy link
Contributor

We defer a bunch of Close() calls to clean up temporary directories, but defers aren't executed if you call os.Exit, so these were leaking when using the --diff flag.

Instead, just return an error, which will still exit with an error code of 1, but only after running the clean up defers.

We defer a bunch of Close() calls to clean up temporary directories, but
defers aren't executed if you call os.Exit, so these were leaking when
using the --diff flag.

Instead, just return an error, which will still exit with an error code
of 1, but only after running the clean up defers.

Signed-off-by: Jon Johnson <[email protected]>
@jonjohnsonjr jonjohnsonjr enabled auto-merge (squash) July 2, 2025 22:47
@jonjohnsonjr jonjohnsonjr merged commit 7609599 into chainguard-dev:main Jul 2, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants