-
-
Notifications
You must be signed in to change notification settings - Fork 54
Fix exit status code on failures #204
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
Conversation
|
Mark this as draft waiting for PR #202 to be merged first. |
3e594e6 to
9d36454
Compare
9d36454 to
66a18b6
Compare
Long-time issues on Thor related to exit status code cause msync to return a inappropriate exit code. As example: rails/thor#244
66a18b6 to
5b305e7
Compare
ekohl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, otherwise 👍
lib/modulesync.rb
Outdated
| .to_a | ||
| else | ||
| $stdout.puts "#{local_template_dir} does not exist." \ | ||
| warn "#{local_template_dir} does not exist." \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is Kernel.warn, right? I'm not sure if that's the correct thing to do. Other places in this file use $stdout.puts and $stderr.puts so I'd prefer to remain consistent. In this case I think it should be $stderr.puts. The same below.
The reason is that you can disable all warnings when you run ruby -W0 which I sometimes do if there's some deprecation warning. Some projects generate them because they're fully Ruby 2.7 clean. That would hide this output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My wish was to write clean code and rubocop recent version advises to turn $stderr.puts int warn but you're right: warn can be disabled using ruby -W0.
So, I will revert the turn from $stderr.puts into warn as its more an error than a warning.
Thanks for notice.
Source: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/StderrPuts
These tests were successful for wrong reasons! This commit fixes the relevant scenarios, by setting correctly the requirements (ie. message and moduleroot)
5b305e7 to
463384f
Compare
|
Thanks! |
On top of #202 , this PR fixes exit status code on failures.
Previously,
msyncoften returns0when errors occurred, this PR sets it to1and turnputsintowarnin order to output the error onstderrinstead ofstdout.