Commit Graph

9 Commits

Author SHA1 Message Date
Benoit Sigoure f69ef84e36 Fix race in the detection of truncation.
Before going into ChangeEvents(), the code was calling stat on the file
to know where it was at, which is incorrect as stat could return the new
file size post truncation.  Instead we now ask the file descriptor about
our current offset, so we can compare our offset to the file size to try
to detect truncation.

Truncation detection remains brittle, but this closes an annoying race
we frequently run into.
2015-10-27 22:42:26 -07:00
Sridhar Ratnakumar 22e519566e Fix tomb import
has moved from launchpad.net (now down) to GitHub, and accessible as
gopkg.in/tomb.v1

closes #33
2014-06-14 23:39:34 -07:00
miraclesu a7f9b4b6fc Fixed stop hang & stop err 2013-09-23 15:03:51 +08:00
Sridhar Ratnakumar 92ad722d56 update readme, comments; gofmt 2013-05-29 16:32:01 -07:00
Sridhar Ratnakumar 499e541b19 copytruncate should work even if ReOpen is False.
at least, `tail -f` (not `tail -F` which is analogous to ReOpen)
reopens truncated files.

this change introduces the FileChanges struct to abstract the change
notifications for file changes, deletions and truncations.
2013-05-29 14:32:59 -07:00
Sridhar Ratnakumar d3c80d385d refactor code for upcoming changes to tail.go 2013-05-29 13:57:02 -07:00
Sridhar Ratnakumar 2cddd48e0a clean up ChangeEvents' goroutines upon tail.Stop 2013-05-29 11:35:27 -07:00
Sridhar Ratnakumar 7599e3efb9 fix tail.Stop blocking when called in midst of re-opening
this is what caused the test to hang occasionally. after this fix,
test completes in 2mins all the time.

closes issue #4
2013-05-28 19:35:12 -07:00
Sridhar Ratnakumar 0f67bc352f make watch.go its own package
for the purpose for upcoming changes to the watch functionality.
2013-05-28 16:37:21 -07:00