Class: Homebrew::DevCmd::Debugger Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/debugger.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/debugger.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::DevCmd::Debugger::Args

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.



10
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/debugger.rbi', line 10

def args; end

#runvoid

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.

Raises:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'dev-cmd/debugger.rb', line 21

def run
  raise UsageError, "Debugger is only supported with portable Ruby!" unless HOMEBREW_USING_PORTABLE_RUBY

  unless Commands.valid_ruby_cmd?(args.named.first)
    raise UsageError, "`#{args.named.first}` is not a valid Ruby command!"
  end

  brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
  debugger_method = if args.open?
    "open"
  else
    "start"
  end

  env = {}
  env[:RUBY_DEBUG_FORK_MODE] = "parent"
  env[:RUBY_DEBUG_NONSTOP] = "1" unless ENV["HOMEBREW_RDBG"]

  with_env(**env) do
    system(*HOMEBREW_RUBY_EXEC_ARGS,
           "-I", $LOAD_PATH.join(File::PATH_SEPARATOR),
           "-rdebug/#{debugger_method}",
           brew_rb, *args.named)
  end
end