Fixes log reopening.
This commit is contained in:
parent
faf842bde7
commit
b0c08f2030
|
@ -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) {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue