Merge pull request #19702 from Homebrew/services-loaded_file
services: add loaded_file data
This commit is contained in:
commit
0d9c0561e1
@ -188,6 +188,11 @@ module Homebrew
|
||||
Regexp.last_match(1).to_i if status_output =~ exit_code_regex(status_type)
|
||||
end
|
||||
|
||||
def loaded_file
|
||||
status_output, _, status_type = status_output_success_type
|
||||
Regexp.last_match(1) if status_output =~ loaded_file_regex(status_type)
|
||||
end
|
||||
|
||||
sig { returns(T::Hash[Symbol, T.anything]) }
|
||||
def to_hash
|
||||
hash = {
|
||||
@ -202,6 +207,7 @@ module Homebrew
|
||||
status: status_symbol,
|
||||
file: service_file_present? ? dest : service_file,
|
||||
registered: service_file_present?,
|
||||
loaded_file:,
|
||||
}
|
||||
|
||||
return hash unless service?
|
||||
@ -302,6 +308,15 @@ module Homebrew
|
||||
@pid_regex.fetch(status_type)
|
||||
end
|
||||
|
||||
def loaded_file_regex(status_type)
|
||||
@loaded_file_regex ||= {
|
||||
launchctl_list: //, # not available
|
||||
launchctl_print: /path = (.*)/,
|
||||
systemctl: /Loaded: .*? \((.*);/,
|
||||
}
|
||||
@loaded_file_regex.fetch(status_type)
|
||||
end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def boot_path_service_file_present?
|
||||
boot_path = System.boot_path
|
||||
|
@ -369,6 +369,7 @@ RSpec.describe Homebrew::Services::FormulaWrapper do
|
||||
exit_code: nil,
|
||||
file: Pathname.new("/usr/local/opt/mysql/homebrew.mysql.plist"),
|
||||
loaded: false,
|
||||
loaded_file: nil,
|
||||
name: "mysql",
|
||||
pid: nil,
|
||||
registered: false,
|
||||
@ -390,6 +391,7 @@ RSpec.describe Homebrew::Services::FormulaWrapper do
|
||||
exit_code: nil,
|
||||
file: Pathname.new("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist"),
|
||||
loaded: false,
|
||||
loaded_file: nil,
|
||||
name: "mysql",
|
||||
pid: nil,
|
||||
registered: true,
|
||||
@ -416,6 +418,7 @@ RSpec.describe Homebrew::Services::FormulaWrapper do
|
||||
file: Pathname.new("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist"),
|
||||
interval: nil,
|
||||
loaded: false,
|
||||
loaded_file: nil,
|
||||
log_path: nil,
|
||||
name: "mysql",
|
||||
pid: nil,
|
||||
|
Loading…
x
Reference in New Issue
Block a user