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)
|
Regexp.last_match(1).to_i if status_output =~ exit_code_regex(status_type)
|
||||||
end
|
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]) }
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
||||||
def to_hash
|
def to_hash
|
||||||
hash = {
|
hash = {
|
||||||
@ -202,6 +207,7 @@ module Homebrew
|
|||||||
status: status_symbol,
|
status: status_symbol,
|
||||||
file: service_file_present? ? dest : service_file,
|
file: service_file_present? ? dest : service_file,
|
||||||
registered: service_file_present?,
|
registered: service_file_present?,
|
||||||
|
loaded_file:,
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash unless service?
|
return hash unless service?
|
||||||
@ -302,6 +308,15 @@ module Homebrew
|
|||||||
@pid_regex.fetch(status_type)
|
@pid_regex.fetch(status_type)
|
||||||
end
|
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) }
|
sig { returns(T::Boolean) }
|
||||||
def boot_path_service_file_present?
|
def boot_path_service_file_present?
|
||||||
boot_path = System.boot_path
|
boot_path = System.boot_path
|
||||||
|
@ -369,6 +369,7 @@ RSpec.describe Homebrew::Services::FormulaWrapper do
|
|||||||
exit_code: nil,
|
exit_code: nil,
|
||||||
file: Pathname.new("/usr/local/opt/mysql/homebrew.mysql.plist"),
|
file: Pathname.new("/usr/local/opt/mysql/homebrew.mysql.plist"),
|
||||||
loaded: false,
|
loaded: false,
|
||||||
|
loaded_file: nil,
|
||||||
name: "mysql",
|
name: "mysql",
|
||||||
pid: nil,
|
pid: nil,
|
||||||
registered: false,
|
registered: false,
|
||||||
@ -390,6 +391,7 @@ RSpec.describe Homebrew::Services::FormulaWrapper do
|
|||||||
exit_code: nil,
|
exit_code: nil,
|
||||||
file: Pathname.new("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist"),
|
file: Pathname.new("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist"),
|
||||||
loaded: false,
|
loaded: false,
|
||||||
|
loaded_file: nil,
|
||||||
name: "mysql",
|
name: "mysql",
|
||||||
pid: nil,
|
pid: nil,
|
||||||
registered: true,
|
registered: true,
|
||||||
@ -416,6 +418,7 @@ RSpec.describe Homebrew::Services::FormulaWrapper do
|
|||||||
file: Pathname.new("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist"),
|
file: Pathname.new("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist"),
|
||||||
interval: nil,
|
interval: nil,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
|
loaded_file: nil,
|
||||||
log_path: nil,
|
log_path: nil,
|
||||||
name: "mysql",
|
name: "mysql",
|
||||||
pid: nil,
|
pid: nil,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user