[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Tail -f in lua, truncate aware?
- From: William Ahern <william@...>
- Date: Fri, 28 Jun 2013 12:01:42 -0700
On Fri, Jun 28, 2013 at 02:42:19PM +0200, Bernd Eggink wrote:
> On 28.06.2013 13:47, ms2008vip wrote:
> > I'd like to make the output of tail -F or something similar
> > available to me in Lua without blocking or blocking.
> > If the file gets truncated or log rotated, the program will detect
> > it and will return to the start. This seems to be
> > a level 1 question but looks strange to me. I just can't figure it
> > out. Does anyone could share some code? TKS
> In Linux you can use poll() or rpoll() from the luaposix library
poll doesn't work on regular files. Or rather, it's defined to immediately
signal readiness, which makes it useless for this case.
"Regular files shall always poll TRUE for reading and writing."