Telnet and out-of-band responses

I wrote:

I need to limit the output, capture it, and terminate it.

More investigation showed that the message was in-band, just that
My regexp was broken and lack of ensure was missing :frowning:

For interest, the main loop looks a little like:

flag = false
begin
  @conn.write("#{cmd}\n")
  str = @conn.waitfor('Match'   => /\$|\>|(to end display)/,
                      'Timeout' => timeout)
  flag = true if str =~ /to end display/    # 'q' needed
  
rescue TimeoutError
  flag = true

ensure
  @conn.write("q\n") if flag 
end 

-mark.