aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/system_command.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-12-03 08:15:22 +0100
committerGitHub2017-12-03 08:15:22 +0100
commitc1b85a6f9d9fd8d46afdcc9488c320d39fcb275d (patch)
treea336ad3debe04507906d0d400641f70afbc5f0d4 /Library/Homebrew/cask/lib/hbc/system_command.rb
parent780e86904beff771e9f7e90fa9e53dd9dc4aeeaf (diff)
parent36c0dbfe13d6185d34a35a1a386d95a3a4046a30 (diff)
downloadbrew-c1b85a6f9d9fd8d46afdcc9488c320d39fcb275d.tar.bz2
Merge pull request #3514 from reitermarkus/system_command
Fix SystemCommand escaping … again.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/system_command.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/system_command.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb
index f64d85c07..a890c42e4 100644
--- a/Library/Homebrew/cask/lib/hbc/system_command.rb
+++ b/Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -50,11 +50,7 @@ module Hbc
end
def command
- @command ||= if sudo?
- [*sudo_prefix, executable, *args]
- else
- [Shellwords.shellescape(executable), *args]
- end
+ [*sudo_prefix, executable, *args]
end
private
@@ -85,8 +81,14 @@ module Hbc
end
def each_output_line(&b)
+ executable, *args = expanded_command
+
+ unless File.exist?(executable)
+ executable = which(executable, PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))
+ end
+
raw_stdin, raw_stdout, raw_stderr, raw_wait_thr =
- Open3.popen3(*expanded_command, **options)
+ Open3.popen3([executable, executable], *args, **options)
write_input_to(raw_stdin)
raw_stdin.close_write