Skip to content
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

[CLI] improve exit handling #170

Merged
merged 5 commits into from
Oct 17, 2023
Merged

[CLI] improve exit handling #170

merged 5 commits into from
Oct 17, 2023

Conversation

jhnstn
Copy link
Member

@jhnstn jhnstn commented Oct 16, 2023

Go will not call the deferred function when os.Exit is called with a non-zero value.

Currently the command is not cleaning up the temp directories if the run ends with an error.

These changes also move the error handling functions out of the console package. Ideally the console package would not have any side effects which this PR helps achieve. For now, our only entry points to the packages is from the /cmd directory, given that it made sense to move the exit handling functions there.

This PR can be tested as is by running the release prepare gbm v1.2.3 command while that command is still not implemented. It will create a temporary directory but end in an error.
It is expected that the temp dir is deleted.

@jhnstn jhnstn requested a review from derekblank October 16, 2023 23:56
Copy link
Contributor

@derekblank derekblank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I was able to test successfully. Merging to incorporate in #169.

@derekblank derekblank merged commit 07241a0 into trunk Oct 17, 2023
1 check passed
@derekblank derekblank deleted the cli/improve-exit-handling branch October 17, 2023 06:10
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