I posted a question here yesterday regarding what I thought was buffered
output, but it turns out it was actually IO#eof not returning until I'd
typed something.
The code originally looked like ...
while !$stdin.eof
$stderr.print "-> "
line = $stdin.gets
#Process line
end
and I thought the print was being buffered. However, after trying lots of
ways to flush the output, I eventually thought "I wonder if the eof() call
isn't returning". Sure enough, it works if I change the code to ...
while true
$stderr.print "-> "
if (line = $stdin.gets) == nil
break
end
#Process line
end
Can someone tell me why the call to $stdin.eof would hang waiting for me to
type something? That doesn't make sense to me.