Protect against nil return codes in rakefiles

This commit is contained in:
Mark VanderVoord
2019-07-06 11:31:31 -04:00
parent 3e82c0a96f
commit 0892db2376
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ module RakefileHelpers
report command_string
output = `#{command_string}`.chomp
report(output) if verbose && !output.nil? && !output.empty?
if !$?.exitstatus.zero? && raise_on_fail
if !$?.nil? && !$?.exitstatus.zero? && raise_on_fail
raise "Command failed. (Returned #{$?.exitstatus})"
end
output
+1 -1
View File
@@ -173,7 +173,7 @@ module RakefileHelpers
report command_string if $verbose
output = `#{command_string}`.chomp
report(output) if $verbose && !output.nil? && !output.empty?
raise "Command failed. (Returned #{$?.exitstatus})" if !$?.exitstatus.zero? && !ok_to_fail
raise "Command failed. (Returned #{$?.exitstatus})" if !$?.nil? && !$?.exitstatus.zero? && !ok_to_fail
output
end