Fix exit status code on failures#204
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
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.
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.
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.