Module: Homebrew::Services::Commands::Restart Private
- Defined in:
- services/commands/restart.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Constant Summary collapse
- TRIGGERS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
Note:The restart command is used to update service files
after a package gets updated through
brew upgrade
. This works by removing the old file withbrew services stop
and installing the new one withbrew services start|run
. %w[restart relaunch reload r].freeze
Class Method Summary collapse
Class Method Details
.run(targets, custom_plist, verbose:) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'services/commands/restart.rb', line 24 def self.run(targets, custom_plist, verbose:) Services::Cli.check(targets) ran = [] started = [] targets.each do |service| if service.loaded? && !service.service_file_present? ran << service else # group not-started services with started ones for restart started << service end Services::Cli.stop([service], verbose:) if service.loaded? end Services::Cli.run(targets, custom_plist, verbose:) if ran.present? Services::Cli.start(started, custom_plist, verbose:) if started.present? end |