Net::Telnet waitfor('Waittime'=>0) may wait forever
waitfor('Waittime'=>0) says it will not wait once the expected prompt has matched, yet if the remote end continues to send data, it will in fact wait, possibly forever.
Line 555 of net/telnet.rb (from 2.0.0) is:
until(prompt === line and not IO::select([@sock], nil, nil, waittime))
Which means even though prompt has matched, it will still call IO::select, and if new data has arrived, it will make another pass through this loop. In my case there is constantly new data arriving (though it is only telnet control data) and so the loop never exits even though the prompt was matched long ago.
I fixed this with:
until(prompt === line and (waittime==0 or not IO::select([@sock], nil, nil, waittime)))
Though I don't know what other implications that change might have.