From aaddce4743dd67f569703daba27d72b5bbfbfadf Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 11 Jun 2018 03:18:47 +0200 Subject: [PATCH] Add `stderr` output to exception. --- Library/Homebrew/style.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index acd3be45c1..71d291b262 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -76,14 +76,14 @@ module Homebrew system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args) !$CHILD_STATUS.success? when :json - json, _, status = Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", "--format", "json", *args) + json, err, status = Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", "--format", "json", *args) # 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. # JSON needs to be at least 2 characters. if !(0..1).cover?(status.exitstatus) || json.to_s.length < 2 - raise "Error running `rubocop --format json #{args.join " "}`" + raise "Error running `rubocop --format json #{args.join " "}`\n#{err}" end RubocopResults.new(JSON.parse(json)) else