lua-users home
lua-l archive

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

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.