From: nobu.nokada@... Date: 2003-12-22T16:16:32+09:00 Subject: Re: BUG in fcntl? Hi, At Mon, 22 Dec 2003 15:01:56 +0900, Mark J. Reed wrote: > In ruby 1.8.1 (2003-12-05) [i686-linux], why does this program: > > require 'fcntl' > > flags = $stdin.fcntl(Fcntl::F_GETFL) > flags |= Fcntl::O_NONBLOCK > > $stdin.fcntl(Fcntl::F_SETFL, flags) > > c = $stdin.getc > puts "c=#{c}" > > Hang on the getc call? Because IO#getc retries at EAGAIN. $stdin.read(1) doesn't stop there but raises Errno::EAGAIN. Or you'd be possible to use IO#ready? and #wait in io/wait library. -- Nobu Nakada