class Byebug::ControlCommandProcessor - byebug-4.0.5 Documentation

# class Byebug::ControlCommandProcessor

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

### Attributes

state[R]

### Public Class Methods

new(interface = LocalInterface.new) click to toggle source
Calls superclass method Byebug::Processor.new

    # File lib/byebug/processors/control_command_processor.rb, line 10
    def initialize(interface = LocalInterface.new)
      super(interface)
    end

### Public Instance Methods

commands() click to toggle source

    # File lib/byebug/processors/control_command_processor.rb, line 14
    def commands
      Command.commands.select(&:allow_in_control).map { |cmd| cmd.new(state) }
    end

process_commands() click to toggle source

    # File lib/byebug/processors/control_command_processor.rb, line 18
    def process_commands
      @state = ControlState.new(interface)

      while (input = @interface.read_command(prompt(nil)))
        cmd = commands.find { |c| c.match(input) }
        unless cmd
          errmsg('Unknown command')
          next
        end

        cmd.execute
      end

      @interface.close
    rescue IOError, SystemCallError
      @interface.close
    rescue
      without_exceptions do
        puts "INTERNAL ERROR!!! #{$ERROR_INFO}"
        puts $ERROR_INFO.backtrace.map { |l| "\t#{l}" }.join("\n")
      end
    end

prompt(_context) click to toggle source

Prompt shown before reading a command.

    # File lib/byebug/processors/control_command_processor.rb, line 44
    def prompt(_context)
      '(byebug:ctrl) '
    end