class Byebug::ControlCommandProcessor


Processes commands in ‘control’ mode, when there’s no program running

def initialize(interface = LocalInterface.new)

def initialize(interface = LocalInterface.new)
  super(interface)
  @context_was_dead = false # Assume we haven't started.
end

def process_commands(verbose = false)

def process_commands(verbose = false)
  control_cmds = Command.commands.select do |cmd|
    cmd.allow_in_control
  end
  state = State.new(@interface, control_cmds)
  commands = control_cmds.map { |cmd| cmd.new(state) }
  if @context_was_dead
    puts 'The program finished.'
    @context_was_dead = false
  end
  while (input = @interface.read_command(prompt(nil)))
    puts("+#{input}") if verbose
    cmd = commands.find { |c| c.match(input) }
    return errmsg('Unknown command') unless cmd
    cmd.execute
  end
rescue IOError, SystemCallError
rescue
  without_exceptions do
    puts "INTERNAL ERROR!!! #{$ERROR_INFO}"
    puts $ERROR_INFO.backtrace.map { |l| "\t#{l}" }.join("\n")
  end
ensure
  @interface.close
end

def prompt(_context)


Prompt shown before reading a command.
def prompt(_context)
  '(byebug:ctrl) '
end