diff --git a/Library/Homebrew/service.rb b/Library/Homebrew/service.rb index 4179873ae6..b2d974b6aa 100644 --- a/Library/Homebrew/service.rb +++ b/Library/Homebrew/service.rb @@ -93,7 +93,7 @@ module Homebrew if command @run_params = command elsif macos || linux - @run_params = { macos:, linux: }.compact, T.any(RunParam, T::Hash[Symbol, RunParam]) + @run_params = { macos:, linux: }.compact end command ||= on_system_conditional(macos:, linux:) @@ -569,7 +569,7 @@ module Homebrew process_type: @process_type, macos_legacy_timers: @macos_legacy_timers, sockets: sockets_var, - }.compact + }.compact_blank end # Turn the service API hash values back into what is expected by the formula DSL. diff --git a/Library/Homebrew/test/service_spec.rb b/Library/Homebrew/test/service_spec.rb index b648094b47..7fc6d6661d 100644 --- a/Library/Homebrew/test/service_spec.rb +++ b/Library/Homebrew/test/service_spec.rb @@ -984,7 +984,7 @@ RSpec.describe Homebrew::Service do expect(command).to eq(["#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd", "test"]) end - it "returns nil on Linux", :needs_linux do + it "returns empty on Linux", :needs_linux do f = stub_formula do service do run macos: [opt_bin/"beanstalkd", "test"] @@ -993,7 +993,7 @@ RSpec.describe Homebrew::Service do end command = f.service.command - expect(command).to be_nil + expect(command).to be_empty end it "returns @run data on macOS", :needs_macos do @@ -1008,7 +1008,7 @@ RSpec.describe Homebrew::Service do expect(command).to eq(["#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd", "test"]) end - it "returns nil on macOS", :needs_macos do + it "returns empty on macOS", :needs_macos do f = stub_formula do service do run linux: [opt_bin/"beanstalkd", "test"] @@ -1017,7 +1017,7 @@ RSpec.describe Homebrew::Service do end command = f.service.command - expect(command).to be_nil + expect(command).to be_empty end it "returns appropriate @run data on Linux", :needs_linux do