Go to file
Benoit Sigoure ac5972aca8 watch: Unsubscribe from fsnotify synchronously.
Calling watcher.Remove() from the run() goroutine is now problematic,
because with the change made in fsnotify/fsnotify#73 Remove() can now
take an arbitrary amount of time, which means we can deadlock if run()
is waiting for fsnotify to acknowledge the removal and fsnotify is
trying to send an unrelated Event.

So instead we now do part of the cleanup, including calling Remove(),
synchronously, in the goroutine trying to unsubscribe.

This fixes #75.  Thanks to Aaron Beitch for the fix.

Change-Id: I346c9eecc34b2378312b07b3c3efc41616b95380
2016-04-08 16:29:40 -07:00
Godeps Godep workspace -> vendor directory 2016-04-07 16:14:15 -07:00
cmd/gotail Fix imports 2015-09-30 17:50:49 +03:00
ratelimiter include License file of original code 2014-04-29 19:56:11 -07:00
util replace the alarmist panic with Fatal 2013-10-11 18:19:43 -07:00
vendor/gopkg.in Godep workspace -> vendor directory 2016-04-07 16:14:15 -07:00
watch watch: Unsubscribe from fsnotify synchronously. 2016-04-08 16:29:40 -07:00
winfile add FILE_SHARE_DELETE flag when opening file 2014-07-28 16:38:02 +03:00
.gitignore remove logyard references and update README 2012-10-17 11:56:54 -07:00
.travis.yml Updated Changes.md and travis.yml 2016-04-07 16:21:17 -07:00
CHANGES.md Updated Changes.md and travis.yml 2016-04-07 16:21:17 -07:00
Dockerfile Fix imports 2015-09-30 17:50:49 +03:00
LICENSE.txt add license and copyright 2013-01-07 12:54:49 -08:00
Makefile Fixes race in test 2016-04-08 11:47:25 -07:00
README.md Update README.md 2015-12-18 15:33:59 -08:00
tail.go Merge branch 'typo-fix' of https://github.com/tcheneau/tail into tcheneau-typo-fix 2016-04-06 16:23:43 -07:00
tail_posix.go Merge branch 'openbsd' of https://github.com/ajacoutot/tail into ajacoutot-openbsd 2015-11-02 12:49:12 -08:00
tail_test.go Fixes race in test 2016-04-08 11:47:25 -07:00
tail_windows.go Fix imports 2015-09-30 17:50:49 +03:00

README.md

Build Status

Go package for tail-ing files

A Go package striving to emulate the features of the BSD tail program.

t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true})
for line := range t.Lines {
    fmt.Println(line.Text)
}

See API documentation.

Log rotation

Tail comes with full support for truncation/move detection as it is designed to work with log rotation tools.

Installing

go get github.com/hpcloud/tail/...

Windows support

This package needs assistance for full Windows support.