From b0c08f203088ee60f2e61c4e5b9dff8f366c4a93 Mon Sep 17 00:00:00 2001 From: Vlad Losev Date: Sat, 18 Mar 2017 14:20:41 -0700 Subject: [PATCH] Fixes log reopening. --- tail_test.go | 4 ++-- watch/inotify_tracker.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tail_test.go b/tail_test.go index 8dcc02c..e29da4b 100644 --- a/tail_test.go +++ b/tail_test.go @@ -343,7 +343,7 @@ func reOpen(t *testing.T, poll bool) { "test.txt", Config{Follow: true, ReOpen: true, Poll: poll}) content := []string{"hello", "world", "more", "data", "endofworld"} - go tailTest.ReadLines(tail, content) + go tailTest.VerifyTailOutput(tail, content, false) // deletion must trigger reopen <-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 // the reading of data written above. Timings can vary based on // test environment. - tail.Cleanup() + tailTest.Cleanup(tail, false) } func reSeek(t *testing.T, poll bool) { diff --git a/watch/inotify_tracker.go b/watch/inotify_tracker.go index 4f85217..a742cd5 100644 --- a/watch/inotify_tracker.go +++ b/watch/inotify_tracker.go @@ -155,6 +155,8 @@ func (shared *InotifyTracker) addWatch(winfo *watchInfo) error { if shared.chans[winfo.fname] == nil { shared.chans[winfo.fname] = make(chan fsnotify.Event) + } + if shared.done[winfo.fname] == nil { shared.done[winfo.fname] = make(chan bool) }