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

Thor: Love (❤️ ) and Thunder (⚡) #1083

Merged
merged 1 commit into from
Jul 29, 2022
Merged

Thor: Love (❤️ ) and Thunder (⚡) #1083

merged 1 commit into from
Jul 29, 2022

Conversation

rafaelfranca
Copy link
Member

Motivation

When working in profiling the check-shims command I was being surprised my profiling data wasn't be written to the disk. I found that it was because we were exiting the process from inside the Command class.

Thor already knows how to deal with exit status, so it is better to use the mechanism so we can make easier to profile out commands.

Implementation

Avoid exit call in the command classes and instead using Thor::Error to provide the messages to STDERR, and exit with the right status.

Thor already knows how to deal with `exit` status.

If call `exit` ourselves, it become harder to reuse those commands,
in say, profiling calls, because as soon the command suceeds, we were
exiting the entire process, not allowing the profiler to dump the
data.

If we use the mechamism inside Thor to handle exits, we also can
simplify the stderr output code.

This also allowed us to fix some TODOs that were in the tests about
the error not being sent to stderr.
@rafaelfranca rafaelfranca requested a review from a team as a code owner July 28, 2022 22:59
@rafaelfranca rafaelfranca merged commit 83b4259 into main Jul 29, 2022
@rafaelfranca rafaelfranca deleted the rm-no-exit branch July 29, 2022 15:34
@paracycle paracycle added bugfix backported Backported to stable branch labels Aug 22, 2022
paracycle pushed a commit that referenced this pull request Aug 22, 2022
Thor: Love (❤️ ) and Thunder (⚡)
@shopify-shipit shopify-shipit bot temporarily deployed to production August 31, 2022 14:40 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Backported to stable branch bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants