Merge pull request #3471 from reitermarkus/system-command

Fix SystemCommand escaping.
This commit is contained in:
Markus Reiter 2017-11-23 17:00:26 +01:00 committed by GitHub
commit 1ff628e20f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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