class DEBUGGER__::UI_ServerBase
def process
def process while true DEBUGGER__.debug{ "sleep IO.select" } _r = IO.select([@sock]) DEBUGGER__.debug{ "wakeup IO.select" } line = @session.process_group.sync do unless IO.select([@sock], nil, nil, 0) DEBUGGER__.debug{ "UI_Server can not read" } break :can_not_read end @sock.gets&.chomp.tap{|line| DEBUGGER__.debug{ "UI_Server received: #{line}" } } end return unless line next if line == :can_not_read case line when /\Apause/ pause when /\Acommand (\d+) (\d+) ?(.+)/ raise "not in subsession, but received: #{line.inspect}" unless @session.in_subsession? if $1.to_i == Process.pid @width = $2.to_i @q_msg << $3 else raise "pid:#{Process.pid} but get #{line}" end when /\Aanswer (\d+) (.*)/ raise "not in subsession, but received: #{line.inspect}" unless @session.in_subsession? if $1.to_i == Process.pid @q_ans << $2 else raise "pid:#{Process.pid} but get #{line}" end else STDERR.puts "unsupported: #{line.inspect}" exit! end end end