diff --git a/Library/Homebrew/services/system/systemctl.rb b/Library/Homebrew/services/system/systemctl.rb index a7a8d912cb..aa2fc1150b 100644 --- a/Library/Homebrew/services/system/systemctl.rb +++ b/Library/Homebrew/services/system/systemctl.rb @@ -29,7 +29,7 @@ module Services _run(*args, mode: :read) end - sig { params(args: T.any(String, Pathname), mode: T.nilable(Symbol)).returns(T.untyped) } + sig { params(args: T.nilable(T.any(String, Pathname)), mode: T.nilable(Symbol)).returns(T.untyped) } private_class_method def self._run(*args, mode:) require "system_command" result = SystemCommand.run(executable, diff --git a/Library/Homebrew/test/services/cli_spec.rb b/Library/Homebrew/test/services/cli_spec.rb index 6d9c002a41..8deb774b3f 100644 --- a/Library/Homebrew/test/services/cli_spec.rb +++ b/Library/Homebrew/test/services/cli_spec.rb @@ -177,7 +177,7 @@ RSpec.describe Services::Cli do describe "#systemd_load", :needs_linux do it "checks non-enabling run" do - expect(Services::System::Systemctl).to receive(:executable).once.and_return("/bin/systemctl") + expect(Services::System::Systemctl).to receive(:executable).once.and_return(Pathname.new("/usr/bin/systemctl")) expect(Services::System::Systemctl).to receive(:scope).once.and_return("--user") services_cli.systemd_load( instance_double(Services::FormulaWrapper, service_name: "name"), @@ -186,7 +186,7 @@ RSpec.describe Services::Cli do end it "checks enabling run" do - expect(Services::System::Systemctl).to receive(:executable).twice.and_return("/bin/systemctl") + expect(Services::System::Systemctl).to receive(:executable).once.and_return(Pathname.new("/usr/bin/systemctl")) expect(Services::System::Systemctl).to receive(:scope).twice.and_return("--user") services_cli.systemd_load( instance_double(Services::FormulaWrapper, service_name: "name"), @@ -198,14 +198,14 @@ RSpec.describe Services::Cli do describe "#launchctl_load", :needs_macos do it "checks non-enabling run" do expect(Services::System).to receive(:domain_target).once.and_return("target") - expect(Services::System).to receive(:launchctl).once.and_return("/bin/launchctl") + expect(Services::System).to receive(:launchctl).once.and_return(Pathname.new("/bin/launchctl")) expect(described_class).to receive(:safe_system).once.and_return(true) services_cli.launchctl_load(instance_double(Services::FormulaWrapper), file: "a", enable: false) end it "checks enabling run" do expect(Services::System).to receive(:domain_target).twice.and_return("target") - expect(Services::System).to receive(:launchctl).twice.and_return("/bin/launchctl") + expect(Services::System).to receive(:launchctl).once.and_return(Pathname.new("/bin/launchctl")) expect(described_class).to receive(:safe_system).twice.and_return(true) services_cli.launchctl_load(instance_double(Services::FormulaWrapper, service_name: "name"), file: "a", enable: true) diff --git a/Library/Homebrew/test/services/system/systemctl_spec.rb b/Library/Homebrew/test/services/system/systemctl_spec.rb index 5a17d8632f..6c2a7f6783 100644 --- a/Library/Homebrew/test/services/system/systemctl_spec.rb +++ b/Library/Homebrew/test/services/system/systemctl_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Services::System::Systemctl do describe ".executable" do it "outputs systemctl command location", :needs_linux do - expect(described_class.executable).to eq("/bin/systemctl") + expect(described_class.executable).to eq(Pathname.new("/usr/bin/systemctl")) end end end