advice for tailing a file

Scott Wiersdorf scott at ipartner.net
Tue Dec 15 00:31:22 CET 2015


On Mon, Dec 14, 2015 at 06:17:04PM -0500, Vikas N Kumar wrote:
> All Unix-clones have a tail command.

Well aware of it... thanks :)

> I don't think there is anything such as a "file append" event in an OS.

Precisely my point. I'd prefer not to use a pipe, but will if that's
the best option.

> You can also do a file read event and if EOF is seen, then check the
> file size to see if it has been closed or if any appending has happened.
> But that is what File::Tail already does.

I have something working pretty well using File::Tail with the nowait
flag set and polling the handle in an EV::run loop (using
EV::RUN_NOWAIT with an EV::sleep 0.1 for the detail oriented).

Scott
-- 
Scott Wiersdorf
scott at ipartner.net



More information about the anyevent mailing list