aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-29 02:40:49 +0200
committerGitHub2017-05-29 02:40:49 +0200
commit52b54aaeb9513500331228b9b1efee34f0174880 (patch)
tree3b769bdc5a6cfdecbfffa765e42c91efeb6afac8 /Library/Homebrew/cmd
parent803f9cbf7ba27ec700ffdfffb976d9b60a5f9deb (diff)
parentdc4f30393741ab7bc8115fa68d8bbbee404f22d9 (diff)
downloadbrew-52b54aaeb9513500331228b9b1efee34f0174880.tar.bz2
Merge pull request #2690 from reitermarkus/rubocop-cache
Use `XDG_CACHE_HOME` for RuboCop.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/style.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index 687ee36b8..228aa360e 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -19,6 +19,7 @@
require "utils"
require "json"
+require "open3"
module Homebrew
module_function
@@ -104,16 +105,16 @@ module Homebrew
when :print
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
args << "--format" << "simple" if files
- system "rubocop", *args
+ system({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", *args)
!$?.success?
when :json
- json = Utils.popen_read_text("rubocop", "--format", "json", *args)
+ json, _, status = Open3.capture3({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", "--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 $?.exitstatus.nil? || $?.exitstatus > 1 || json.to_s.length < 2
+ if !status.success? || json.to_s.length < 2
raise "Error running `rubocop --format json #{args.join " "}`"
end
RubocopResults.new(JSON.parse(json))