From a98b35d92468c1d1f01fb43b40f60931f9df591f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 22 Nov 2017 23:12:13 +0100 Subject: [PATCH] Fix SystemCommand escaping. --- Library/Homebrew/cask/lib/hbc/system_command.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index ea440991f1..f64d85c075 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -1,5 +1,6 @@ require "open3" require "vendor/plist/plist" +require "shellwords" require "extend/io" @@ -49,11 +50,11 @@ module Hbc end def command - @command ||= [ - *sudo_prefix, - executable, - *args, - ].freeze + @command ||= if sudo? + [*sudo_prefix, executable, *args] + else + [Shellwords.shellescape(executable), *args] + end end private