From 2eb366ff386674bcd2eec760fdaef25dff665063 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 24 Oct 2017 18:28:21 +0200 Subject: Fix `SystemCommand` without arguments. --- Library/Homebrew/compat/hbc.rb | 1 + Library/Homebrew/compat/hbc/system_command.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Library/Homebrew/compat/hbc/system_command.rb (limited to 'Library/Homebrew/compat') 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 -- cgit v1.2.3