mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #3362 from reitermarkus/system-command
Fix `SystemCommand` without arguments.
This commit is contained in:
commit
302bc8be22
@ -1,5 +1,4 @@
|
|||||||
require "open3"
|
require "open3"
|
||||||
require "shellwords"
|
|
||||||
require "vendor/plist/plist"
|
require "vendor/plist/plist"
|
||||||
|
|
||||||
require "extend/io"
|
require "extend/io"
|
||||||
@ -38,8 +37,6 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, must_succeed: false, **options)
|
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
|
@executable = executable
|
||||||
@args = args
|
@args = args
|
||||||
@sudo = sudo
|
@sudo = sudo
|
||||||
|
@ -4,6 +4,7 @@ require "compat/hbc/cache"
|
|||||||
require "compat/hbc/caskroom"
|
require "compat/hbc/caskroom"
|
||||||
require "compat/hbc/cli"
|
require "compat/hbc/cli"
|
||||||
require "compat/hbc/dsl"
|
require "compat/hbc/dsl"
|
||||||
|
require "compat/hbc/system_command"
|
||||||
|
|
||||||
module Hbc
|
module Hbc
|
||||||
class << self
|
class << self
|
||||||
|
18
Library/Homebrew/compat/hbc/system_command.rb
Normal file
18
Library/Homebrew/compat/hbc/system_command.rb
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user