Harry Ohlsen <harryo / zip.com.au> writes: > while !$stdin.eof > $stderr.print "-> " > line = $stdin.gets > #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. A cat sits in a closed box in front of a keyboard. Next to it is a lump of radioactive catnip. If the catnip emits an alpha particle, the cat types ^D, signaling end of file. Otherwise the cat types the first character of War and Peace. The Ruby interpreter sits outside the box, at the $stdin.feof line. It has a problem. In order to tell if the file is at eof, it has to read the next line (as the terminal is in cooked mode). If it doesn't read the next line, then it won't see the ^D. You'd then complain that eof returned false, but the next read failed because it was actually at EOF. If it _does_ read the line, then you complain that the prompt doesn't get written before the next line is read. So the interpreter punts, and just calls the C library feof() routine, so it can blame the library for whatever behavior happens. You can solve this fairly tidily using something like loop do print "-> " break unless line = gets # process line end Regards Dave ps. My math isn't up to much, but from the cat's point of view, aren't we topologically inside the box? Does this strike anyone as dangerous?