Closed aufflick closed 10 years ago
@FabioPelosin are you sure .to_i is required? A big downside to that approach is that if the symbol is nil (eg. when $CHILD_STATUS does not exist as a variable) then .to_i will return zero and thus indicate success.
§ ruby -e "print nil.to_i == 0 ? 'yes' : 'no'"
yes
§ ruby -e 'print $FLUBBER.to_i == 0 ? "yes" : "no"'
yes
If you do need to force to integer for comparison you should probably check for nil first also. I know
@aufflick Thanks... I added the .to_i
expecting to raise a no method error in case of nil
... actually I've read about this behavior but it was completely lost in the inners of my mind.
I will fix it... thanks!
@FabioPelosin I don’t particularly like them, but can we just use the default Ruby globals instead? I.e. $?
in this situation?
@alloy I was planning to go back to $?
as long as we support Ruby 1.8.7 because it is just not worth it (working on another gem I have disabled this check on the cocoapods configuration of RuboCop exactly for this reason).
:+1:
See CocoaPods/CocoaPods#2225
This causes
ref_exists?
to always return false.I don't know why it doesn't cause other issues elsewhere, but the nicely named $CHILD_STATUS global var in ruby 1.9 and later (or something, not exactly sure of the circumstances). It's fixed if you replace $CHILD_STATUS with the timeless $? or place require "English" at the top of git.rb (although that may introduce a new ruby version dependency, I'm not familiar with when it was introduced).