Fixes log reopening.

This commit is contained in:
Vlad Losev 2017-03-18 14:20:41 -07:00
parent faf842bde7
commit b0c08f2030
No known key found for this signature in database
GPG Key ID: 3A3C3B9FAA3AB7AE
2 changed files with 4 additions and 2 deletions

View File

@ -343,7 +343,7 @@ func reOpen(t *testing.T, poll bool) {
"test.txt", "test.txt",
Config{Follow: true, ReOpen: true, Poll: poll}) Config{Follow: true, ReOpen: true, Poll: poll})
content := []string{"hello", "world", "more", "data", "endofworld"} content := []string{"hello", "world", "more", "data", "endofworld"}
go tailTest.ReadLines(tail, content) go tailTest.VerifyTailOutput(tail, content, false)
// deletion must trigger reopen // deletion must trigger reopen
<-time.After(delay) <-time.After(delay)
@ -366,7 +366,7 @@ func reOpen(t *testing.T, poll bool) {
// Do not bother with stopping as it could kill the tomb during // Do not bother with stopping as it could kill the tomb during
// the reading of data written above. Timings can vary based on // the reading of data written above. Timings can vary based on
// test environment. // test environment.
tail.Cleanup() tailTest.Cleanup(tail, false)
} }
func reSeek(t *testing.T, poll bool) { func reSeek(t *testing.T, poll bool) {

View File

@ -155,6 +155,8 @@ func (shared *InotifyTracker) addWatch(winfo *watchInfo) error {
if shared.chans[winfo.fname] == nil { if shared.chans[winfo.fname] == nil {
shared.chans[winfo.fname] = make(chan fsnotify.Event) shared.chans[winfo.fname] = make(chan fsnotify.Event)
}
if shared.done[winfo.fname] == nil {
shared.done[winfo.fname] = make(chan bool) shared.done[winfo.fname] = make(chan bool)
} }