diff options
| author | Markus Reiter | 2017-10-31 04:58:38 +0100 |
|---|---|---|
| committer | GitHub | 2017-10-31 04:58:38 +0100 |
| commit | 302bc8be22c9f645a110815f52f252a78c666d0f (patch) | |
| tree | 856de5e7819f69bcf0adde4761729c59a85c232d /Library | |
| parent | 2d5bb029a51f17d15ee6a61160297a748c28f6be (diff) | |
| parent | 2eb366ff386674bcd2eec760fdaef25dff665063 (diff) | |
| download | brew-302bc8be22c9f645a110815f52f252a78c666d0f.tar.bz2 | |
Merge pull request #3362 from reitermarkus/system-command
Fix `SystemCommand` without arguments.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/system_command.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/compat/hbc.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/compat/hbc/system_command.rb | 18 |
3 files changed, 19 insertions, 3 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index 3c8311a3b..ea440991f 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -1,5 +1,4 @@ require "open3" -require "shellwords" require "vendor/plist/plist" require "extend/io" @@ -38,8 +37,6 @@ module Hbc end def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, must_succeed: false, **options) - executable, *args = Shellwords.shellescape(executable) if args.empty? - @executable = executable @args = args @sudo = sudo diff --git a/Library/Homebrew/compat/hbc.rb b/Library/Homebrew/compat/hbc.rb index 608d46e37..ebf8a9874 100644 --- a/Library/Homebrew/compat/hbc.rb +++ b/Library/Homebrew/compat/hbc.rb @@ -4,6 +4,7 @@ require "compat/hbc/cache" require "compat/hbc/caskroom" require "compat/hbc/cli" require "compat/hbc/dsl" +require "compat/hbc/system_command" module Hbc class << self diff --git a/Library/Homebrew/compat/hbc/system_command.rb b/Library/Homebrew/compat/hbc/system_command.rb new file mode 100644 index 000000000..bb9187db3 --- /dev/null +++ b/Library/Homebrew/compat/hbc/system_command.rb @@ -0,0 +1,18 @@ +require "shellwords" + +module SystemCommandCompatibilityLayer + def initialize(executable, args: [], **options) + if args.empty? && !File.exist?(executable) + odeprecated "`system_command` with a shell string", "`system_command` with the `args` parameter" + executable, *args = Shellwords.shellsplit(executable) + end + + super(executable, args: args, **options) + end +end + +module Hbc + class SystemCommand + prepend SystemCommandCompatibilityLayer + end +end |
