diff options
| author | Margaret Lewicka | 2016-07-16 21:58:47 +0100 |
|---|---|---|
| committer | Martin Afanasjew | 2016-07-16 22:58:47 +0200 |
| commit | b51283424321cb996d0a587e9a62a070d21f3342 (patch) | |
| tree | 0bff9c83418e5eadaff4f15afa00316712b441a8 /Library | |
| parent | 242508fca4d2b167cef3c355722f3471594d7b4b (diff) | |
| download | brew-b51283424321cb996d0a587e9a62a070d21f3342.tar.bz2 | |
audit: prevent crash from nil exitstatus (#532)
If rubocop invocation from brew audit exits with nil exitstatus,
brew audit fails with 'undefined method `>' for nil:NilClass'.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/style.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index ca28ca712..61e2b7908 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -63,8 +63,10 @@ module Homebrew !$?.success? when :json json = Utils.popen_read_text("rubocop", "--format", "json", *args) - # exit status of 1 just means violations were found; others are errors - raise "Error while running rubocop" if $?.exitstatus > 1 + # exit status of 1 just means violations were found; other numbers mean execution errors + # exitstatus can also be nil if RuboCop process crashes, e.g. due to + # native extension problems + raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1 RubocopResults.new(Utils::JSON.load(json)) else raise "Invalid output_type for check_style_impl: #{output_type}" |
