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
46
47
|
# File 'lib/ruby-debug/processor.rb', line 21
def process_commands
@printer.print_debug("Starting command read loop")
ctrl_cmd_classes = Command.commands.select{|cmd| cmd.control}
state = ControlState.new(@interface)
ctrl_cmds = ctrl_cmd_classes.map{|cmd| cmd.new(state, @printer)}
while input = @interface.read_command
@printer.print_debug "Processing: #{input.gsub('%', '%%')}"
catch(:debug_error) do
if cmd = ctrl_cmds.find{|c| c.match(input) }
cmd.execute
else
process_context_commands(input)
end
end
end
rescue IOError, Errno::EPIPE
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
rescue Exception
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
ensure
@interface.close
end
|