bundle: add --services
flag for sh and exec
This commit is contained in:
parent
786ad348a5
commit
c7e8b66da3
@ -47,7 +47,7 @@ module Homebrew
|
||||
|
||||
PATH_LIKE_ENV_REGEX = /.+#{File::PATH_SEPARATOR}/
|
||||
|
||||
def self.run(*args, global: false, file: nil, subcommand: "")
|
||||
def self.run(*args, global: false, file: nil, subcommand: "", services: false)
|
||||
# Cleanup Homebrew's global environment
|
||||
HOMEBREW_ENV_CLEANUP.each { |key| ENV.delete(key) }
|
||||
|
||||
@ -157,7 +157,18 @@ module Homebrew
|
||||
return
|
||||
end
|
||||
|
||||
exec(*args)
|
||||
if services
|
||||
require "bundle/commands/services"
|
||||
|
||||
exit_code = 0
|
||||
Services.run_services(@dsl.entries) do
|
||||
Kernel.system(*args)
|
||||
exit_code = $CHILD_STATUS.exitstatus
|
||||
end
|
||||
exit!(exit_code)
|
||||
else
|
||||
exec(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -114,6 +114,12 @@ module Homebrew
|
||||
yield
|
||||
ensure
|
||||
stop_services(entries)
|
||||
|
||||
conflicting_services.each do |conflict|
|
||||
if conflict["running"] && conflict["registered"] && !Bundle::BrewServices.run(conflict["name"])
|
||||
opoo "Failed to restart #{conflict["name"]} service"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -89,6 +89,8 @@ module Homebrew
|
||||
"even if `$HOMEBREW_BUNDLE_NO_UPGRADE` is set. "
|
||||
switch "--install",
|
||||
description: "Run `install` before continuing to other operations e.g. `exec`."
|
||||
switch "--services",
|
||||
description: "Temporarily start services while running the `exec` or `sh` command."
|
||||
switch "-f", "--force",
|
||||
description: "`install` runs with `--force`/`--overwrite`. " \
|
||||
"`dump` overwrites an existing `Brewfile`. " \
|
||||
@ -238,7 +240,7 @@ module Homebrew
|
||||
["env"]
|
||||
end
|
||||
require "bundle/commands/exec"
|
||||
Homebrew::Bundle::Commands::Exec.run(*named_args, global:, file:, subcommand:)
|
||||
Homebrew::Bundle::Commands::Exec.run(*named_args, global:, file:, subcommand:, services: args.services?)
|
||||
when "list"
|
||||
require "bundle/commands/list"
|
||||
Homebrew::Bundle::Commands::List.run(
|
||||
|
@ -59,6 +59,9 @@ class Homebrew::Cmd::Bundle::Args < Homebrew::CLI::Args
|
||||
sig { returns(T::Boolean) }
|
||||
def no_vscode?; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def services?; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def tap?; end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user