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 EOS
# command needs to be first because it initializes all other values # 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(" ") &.join(" ")
options = [] options = []

View File

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