Commit Graph

136 Commits

Author SHA1 Message Date
Sridhar Ratnakumar c5b73d3485 add NewLine helper to create a Line instance 2013-11-14 09:44:28 -08:00
Sridhar Ratnakumar f3593827b3 Merge pull request #20 from ActiveState/inotify_cleanup
add Cleanup function to close open inotify watches
2013-11-13 17:43:11 -08:00
Sridhar Ratnakumar accbe0dc99 descriptive comment for the Cleanup function 2013-11-13 17:41:13 -08:00
Sridhar Ratnakumar 6ffcd854c1 run 'go fmt' (and fix 'make fmt' in Makefile) 2013-11-13 17:38:23 -08:00
Sridhar Ratnakumar ebc25f9788 update change log 2013-11-13 17:37:03 -08:00
Sridhar Ratnakumar 323e1c0988 add Cleanup function to close open inotify watches
bug: 101635
2013-11-12 20:15:27 -08:00
Sridhar Ratnakumar 7cb0dcdbe1 add deps.json for use with depman 2013-11-07 21:09:27 -08:00
Sridhar Ratnakumar 56c4b221b8 replace the alarmist panic with Fatal
Fatal shows only a single goroutine stacktrace.
2013-10-11 18:19:43 -07:00
Sridhar Ratnakumar 88298d7cf8 Merge pull request #18 from miraclesu/fix_stop_hang
Fix a hang in `Stop` when tailing a non-existent file

Reproducible on linux, but not on mac.
2013-09-23 18:19:18 -07:00
miraclesu 058eb3d8df combine two if conditions 2013-09-24 09:13:19 +08:00
Sridhar Ratnakumar c9444e81ae Merge pull request #17 from presbrey/patch-1
fix race/panic on modify+delete
2013-09-23 11:58:53 -07:00
miraclesu a7f9b4b6fc Fixed stop hang & stop err 2013-09-23 15:03:51 +08:00
presbrey afd80c034c fix race/panic on modify+delete
This fixes a race condition when a file is modified and unlinked in the OS before the inotify IsModify event has a chance to call os.Stat.
2013-09-22 22:51:12 -04:00
Sridhar Ratnakumar 45a47abe0e refactor 2013-09-17 16:54:55 -07:00
Sridhar Ratnakumar 4fb4f2aa10 fulltest: run go install 2013-09-09 03:20:08 +00:00
Sridhar Ratnakumar f3332f1697 fulltest must use the local source, not master 2013-09-09 03:13:12 +00:00
Sridhar Ratnakumar 45e3f1a853 system testing using docker 2013-09-09 03:04:39 +00:00
Sridhar Ratnakumar b87764baaf Merge pull request #14 from QLeelulu/master
add Tell to return the file's current position, like stdio's ftell().
2013-08-24 14:01:07 -07:00
QLeelulu 1a8af20665 add tail.Tell's test 2013-08-24 15:43:25 +08:00
QLeelulu 40bd571489 add Tell to return the file's current position, like stdio's ftell(). 2013-08-23 18:04:21 +08:00
Sridhar Ratnakumar 277b98d6a1 update README 2013-08-09 15:15:40 -07:00
Sridhar Ratnakumar fdc1517c8b Merge pull request #12 from ActiveState/better_location
Ability to seek to anywhere in the file before tailing
2013-08-09 15:10:35 -07:00
Sridhar Ratnakumar 275e6442bd tests for the new Location spec 2013-08-09 14:57:38 -07:00
Sridhar Ratnakumar faf14146e7 tail.Location is now the most customizable
as it is now a tuple; (offset, whence) from os.Seek
2013-08-09 14:53:37 -07:00
Sridhar Ratnakumar 8d9c6e4ce1 allow seeking from beginning and end 2013-08-09 14:42:51 -07:00
Sridhar Ratnakumar 1e2bc8afe8 support arbitrary values for `Location` 2013-07-12 15:30:31 -07:00
Sridhar Ratnakumar 6af3d03d43 typo 2013-07-11 18:36:12 -07:00
Sridhar Ratnakumar 1faae64bdb Merge pull request #10 from ActiveState/rate_limiting
option to limit the rate of reading lines from files
2013-07-11 18:35:26 -07:00
Sridhar Ratnakumar b2509e165e option to limit the rate of reading lines from files 2013-07-11 17:28:18 -07:00
Sridhar Ratnakumar f461ddc97d support Follow=false 2013-05-30 13:18:46 -07:00
Sridhar Ratnakumar 92ad722d56 update readme, comments; gofmt 2013-05-29 16:32:01 -07:00
Sridhar Ratnakumar 4deef2319f Merge pull request #7 from srid/copytruncate_reopen_false
Truncated files must be reopened even if ReOpen is false
2013-05-29 15:26:00 -07:00
Sridhar Ratnakumar 68dffd22b4 fix a regression with truncation detection 2013-05-29 15:08:24 -07:00
Sridhar Ratnakumar de27e252a7 truncate tests should not use ReOpen 2013-05-29 15:08:10 -07:00
Sridhar Ratnakumar 0758578f6c gotail: add -p argument to use polling 2013-05-29 15:07:53 -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
Sridhar Ratnakumar b664e9fc9d Merge pull request #6 from srid/bug99139_copytruncate
copytruncate support,

truncation detection for both inotify and polling file watchers along with test cases, plus a fix for issue #5.
2013-05-28 14:03:12 -07:00
Sridhar Ratnakumar 976fc15b81 update change log, gofmt and remove debug prints 2013-05-28 14:01:32 -07:00
Sridhar Ratnakumar 644891ebbc BlockUntilExists should return immediately if the file already exists
this fixes a potential race condition in the use of BlockUntilExists
following a file existence check (as we do in tail.go:reopen).

closes issue 5
2013-05-28 13:29:40 -07:00
Sridhar Ratnakumar fb37e0b7ca use a smaller poll duration for faster test runs 2013-05-28 12:55:11 -07:00
Sridhar Ratnakumar c90cd7b8db add truncation detection to PollingFileWatcher 2013-05-28 12:54:53 -07:00
Sridhar Ratnakumar 5ccafcc3d6 fixes on top of Florian's truncation detection (1ff299bc2)
* initialize `Size` with the then-size of the file when ChangeEvents
  is called. remember that this function is expected to be called many
  times, one after another. this also passes the TestReSeekInotify
  test.

* do not ignore errors from os.Stat. we panic errors like these now,
  but ideally should switch to tomb.Tomb for letting the user handle
  them.
2013-05-28 12:31:46 -07:00
Sridhar Ratnakumar 8c443fb067 fix truncation tests
* use O_TRUNC to actually truncate
* use longer initial data before truncating

truncated and updated file is expected to be of smaller size, else
truncation detection won't work.

ref: https://github.com/josegonzalez/beaver/pull/67/files
2013-05-28 12:28:56 -07:00
Florian Weingarten 1ff299bc29 Add support for file truncation in InotifyFileWatcher
(cherry picked from commit 9de77aad8caca8102e7dd7c936d00ca3f0421ca7)
2013-05-28 11:59:03 -07:00
Sridhar Ratnakumar e9c3c07fbb add (failing) tests for copytruncate detection 2013-05-28 11:46:49 -07:00
Sridhar Ratnakumar ad34bda357 Merge pull request #3 from srid/bug99126_rotation_when_polling
Make tail work with file rotation when using polling file watcher
2013-05-28 11:07:12 -07:00