Imitating "tail -f"

Jason Sewall jasonsewall at gmail.com
Sat Nov 21 23:32:16 EST 2009


FWIW, GNU tail on Linux uses inotify for tail -f:

http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/tail.c

The wikipedia page for inotify lists several python bindings:

http://en.wikipedia.org/wiki/Inotify

Not much help for non-Linux users, but there it is. Too bad, because inotify
is pretty cool.

Jason

On Nov 21, 2009 11:11 PM, <exarkun at twistedmatrix.com> wrote:

On 02:43 am, ivoras at gmail.com wrote: > > I'm trying to simply imitate what
"tail -f" does, i.e. read...
select(), poll(), epoll, etc. all have the problem where they don't support
files (in the thing-on-a-filesystem sense) at all.  They just indicate the
descriptor is readable or writeable all the time, regardless.

"tail -f" is implemented by sleeping a little bit and then reading to see if
there's anything new.

Jean-Paul

-- http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091121/8c927148/attachment-0001.html>


More information about the Python-list mailing list