service: fix systemd command line quoting

Fixes #18802 (affected formulae still need rebuilding).
This commit is contained in:
Ruoyu Zhong 2024-12-04 02:51:26 +08:00
parent 15146b2b67
commit bba67ec02e
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -465,7 +465,7 @@ module Homebrew
EOS
# command needs to be first because it initializes all other values
cmd = command&.map { |arg| Utils::Shell.sh_quote(arg) }
cmd = command&.map { |arg| Utils::Service.systemd_quote(arg) }
&.join(" ")
options = []

View File

@ -727,7 +727,7 @@ RSpec.describe Homebrew::Service do
[Service]
Type=simple
ExecStart=#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd test
ExecStart="#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd" "test"
Restart=always
RestartSec=30
WorkingDirectory=#{HOMEBREW_PREFIX}/var
@ -760,7 +760,7 @@ RSpec.describe Homebrew::Service do
[Service]
Type=oneshot
ExecStart=#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd
ExecStart="#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd"
EOS
expect(unit).to eq(unit_expect.strip)
end
@ -783,7 +783,7 @@ RSpec.describe Homebrew::Service do
[Service]
Type=simple
ExecStart=#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd
ExecStart="#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd"
WorkingDirectory=#{Dir.home}
EOS
expect(unit).to eq(unit_expect.strip)