wordpress-mobile / release-toolkit-gutenberg-mobile

Automation Scripts for Releasing Gutenberg-Mobile Updates to the WordPress Mobile Apps.
Mozilla Public License 2.0
5 stars 2 forks source link

[CLI] improve exit handling #170

Closed jhnstn closed 10 months ago

jhnstn commented 10 months ago

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.