提交 0892db23 编写于 作者: M Mark VanderVoord

Protect against nil return codes in rakefiles

上级 3e82c0a9
...@@ -141,7 +141,7 @@ module RakefileHelpers ...@@ -141,7 +141,7 @@ module RakefileHelpers
report command_string report command_string
output = `#{command_string}`.chomp output = `#{command_string}`.chomp
report(output) if verbose && !output.nil? && !output.empty? 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})" raise "Command failed. (Returned #{$?.exitstatus})"
end end
output output
......
...@@ -173,7 +173,7 @@ module RakefileHelpers ...@@ -173,7 +173,7 @@ module RakefileHelpers
report command_string if $verbose report command_string if $verbose
output = `#{command_string}`.chomp output = `#{command_string}`.chomp
report(output) if $verbose && !output.nil? && !output.empty? 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 output
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册