services: prioritise launchctl print over launchctl list.
In https://github.com/Homebrew/brew/pull/19602 we changed `launchctl list` to pass the domain target. Sadly, this is not valid syntax. Instead, restore passing the `service_name` to `launchctl list` and instead use `launchctl print` first to query the more specific domain target before we fall back to the less specific service name.
This commit is contained in:
parent
e537b716e8
commit
c592ae63dd
@ -235,19 +235,19 @@ module Homebrew
|
|||||||
|
|
||||||
def status_output_success_type
|
def status_output_success_type
|
||||||
@status_output_success_type ||= if System.launchctl?
|
@status_output_success_type ||= if System.launchctl?
|
||||||
cmd = [System.launchctl.to_s, "list", "#{System.domain_target}/#{service_name}"]
|
cmd = [System.launchctl.to_s, "print", "#{System.domain_target}/#{service_name}"]
|
||||||
output = Utils.popen_read(*cmd).chomp
|
output = Utils.popen_read(*cmd).chomp
|
||||||
if $CHILD_STATUS.present? && $CHILD_STATUS.success? && output.present?
|
if $CHILD_STATUS.present? && $CHILD_STATUS.success? && output.present?
|
||||||
success = true
|
success = true
|
||||||
odebug cmd.join(" "), output
|
type = :launchctl_print
|
||||||
[output, success, :launchctl_list]
|
|
||||||
else
|
else
|
||||||
cmd = [System.launchctl.to_s, "print", "#{System.domain_target}/#{service_name}"]
|
cmd = [System.launchctl.to_s, "list", service_name]
|
||||||
output = Utils.popen_read(*cmd).chomp
|
output = Utils.popen_read(*cmd).chomp
|
||||||
success = $CHILD_STATUS.present? && $CHILD_STATUS.success? && output.present?
|
success = $CHILD_STATUS.present? && $CHILD_STATUS.success? && output.present?
|
||||||
odebug cmd.join(" "), output
|
type = :launchctl_list
|
||||||
[output, success, :launchctl_print]
|
|
||||||
end
|
end
|
||||||
|
odebug cmd.join(" "), output
|
||||||
|
[output, success, type]
|
||||||
elsif System.systemctl?
|
elsif System.systemctl?
|
||||||
cmd = ["status", service_name]
|
cmd = ["status", service_name]
|
||||||
output = System::Systemctl.popen_read(*cmd).chomp
|
output = System::Systemctl.popen_read(*cmd).chomp
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user