lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

It was thus said that the Great Sam Roberts once stated:
> On Fri, Feb 18, 2011 at 3:04 AM, Tony Finch <> wrote:
> > I note that if the reader function is a simple wrapper around the read(2)
> > syscall then it is possible for it to return EOF then on a subsequent call
> > return some data, e.g. if the input is a terminal.
> read() should block on read from a terminal -- or if the fd is set
> non-blocking, return -1.
> read() will return zero on EOF, and then return some positive value if
> more is written to the end of file, but that's pretty pathological.

  Not really.  "tail -f file" will read until it gets EOF (a read of 0
bytes), then wait a second (sleep(1)), then try reading agail.