Well, there's always (last (line-seq foo)) ...
Tail just polls the file every 1 second or whatever (it's configurable
-s option) and check's if the file's length has changed. You can do
this yourself easily enough.
Some discussion here (it's Java, but you'd do exactly the same in Clojure):
http://stackoverflow.com/questions/557844/java-io-implementation-of-unix-linux-tail-f
When I've had this problem myself (on unix), I've just been lazy and
implemented it by doing:
tail -f somefile.log | java ...
Or shelling out to `tail' from within the program. Ugly perhaps, but I
know GNU tail behaves the way I want when the file is truncated and
such. :-P
> Java has a file watch API to avoid polling.
I assume you're talking about the NIO 2 watch service? That's not
yet in a released version of Java, it's coming in Java 7.
> Stuart Sierra uses it to good effect in lazytest.
It looks to me like lazytest polls the last modified date every 500 ms.
https://gist.github.com/727982
Any feedback would be appreciated.
-Todd