Sha256: 42772a43436e8d14954bbaf1daf4e89af618f7852871c676d59e7a542ad21527

Contents?: true

Size: 954 Bytes

Versions: 8

Compression:

Stored size: 954 Bytes

Contents

require 'byebug/processors/command_processor'

module Byebug
  #
  # Processes commands from a file
  #
  class ScriptProcessor < CommandProcessor
    #
    # Available commands
    #
    def commands
      super.select(&:allow_in_control)
    end

    def process_commands
      while (input = interface.read_command(prompt))
        command = command_list.match(input)

        if command
          command.new(self, input).execute
        else
          errmsg('Unknown command')
        end
      end

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

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

    private

    def without_exceptions
      yield
    rescue
      nil
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
byebug-9.0.3 lib/byebug/processors/script_processor.rb
byebug-9.0.2 lib/byebug/processors/script_processor.rb
byebug-9.0.1 lib/byebug/processors/script_processor.rb
byebug-9.0.0 lib/byebug/processors/script_processor.rb
byebug-8.2.5 lib/byebug/processors/script_processor.rb
byebug-8.2.4 lib/byebug/processors/script_processor.rb
byebug-8.2.3 lib/byebug/processors/script_processor.rb
byebug-8.2.2 lib/byebug/processors/script_processor.rb