In message <1enk84e.jd9vy8hk39j8N%schuerig / acm.org>
schuerig / acm.org writes:

> I'm trying to watch some (log)files for changes. For this purpose,
> non-blocking I/O and the select function look promising, unfortunately,
> I don't get them to work.

You intended `tail -f'?


>         s = f.read();

Probably here is problem.  How about replacing this `read' with
`sysread'?


> In the first iteration through the while-loop, the test file is read up
> to EOF; when I then append more lines to it, select wakes up, but
> apparently read doesn't read the new lines. What's happening?

IO#read uses fread(3) internally, so this depends on underlying
implementation of fread(3).... but you should not expect fread(3) can
read from a stream already reached to EOF without clearerr(3).  If you
want to use IO#read, call IO#rewind then IO#seek to previous end point
of read.  IO#rewind call clearerr(3) internally, so your code may
work....


....Story above is summarized from posts to ruby-list.  Well, that
threads is on implementing `tail -f' itself.  Hope this help you.


-- 
kjana / os.xaxon.ne.jp                               January 21, 2001
Out of frying-pan, into the fire.