Skip to content
Snippets Groups Projects
Commit b5128342 authored by Margaret Lewicka's avatar Margaret Lewicka Committed by Martin Afanasjew
Browse files

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'.
parent 242508fc
No related branches found
No related tags found
No related merge requests found
......@@ -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}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment