diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb index 95ac2b088cd37d25e536b001f7cb59f4dba1085f..edee1f3c4900fd4083e17234da916528fbd88eaf 100644 --- a/Library/Homebrew/cask/cmd/style.rb +++ b/Library/Homebrew/cask/cmd/style.rb @@ -11,7 +11,9 @@ module Cask install_rubocop cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" } hide_warnings = debug? ? [] : [ENV["HOMEBREW_RUBY_PATH"], "-W0", "-S"] - system(cache_env, *hide_warnings, "rubocop", *rubocop_args, "--", *cask_paths) + Dir.mktmpdir do |tmpdir| + system(cache_env, *hide_warnings, "rubocop", *rubocop_args, "--", *cask_paths, chdir: tmpdir) + end raise CaskError, "style check failed" unless $CHILD_STATUS.success? end