service: correctly quote arguments.

If you have a run argument with a space in it: it will need to be quoted
to be passed through correctly when run as a manual command.

Fixes #15871.
This commit is contained in:
Mike McQuaid 2023-08-16 11:18:26 +01:00
parent 4c87937b98
commit 6d65ec3afb
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829

View File

@ -398,7 +398,7 @@ module Homebrew
vars = @environment_variables.except(:PATH) vars = @environment_variables.except(:PATH)
.map { |k, v| "#{k}=\"#{v}\"" } .map { |k, v| "#{k}=\"#{v}\"" }
out = vars + command if command? out = vars + T.must(command).map { |arg| Utils::Shell.sh_quote(arg) } if command?
out.join(" ") out.join(" ")
end end