check the stop channel while waiting on inotify
fixes http://bugs.activestate.com/show_bug.cgi?id=95718#c3
This commit is contained in:
parent
3ff602e781
commit
5c84486ca3
13
tail.go
13
tail.go
|
@ -146,10 +146,8 @@ func (tail *Tail) tailFileSync(end bool, retry bool) {
|
||||||
changes = tail.watcher.ChangeEvents()
|
changes = tail.watcher.ChangeEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.Println("WAITING ", tail.Filename)
|
select {
|
||||||
_, ok := <-changes
|
case _, ok := <-changes:
|
||||||
//log.Println("RECEIVED ", tail.Filename)
|
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
// file got deleted/renamed
|
// file got deleted/renamed
|
||||||
if retry {
|
if retry {
|
||||||
|
@ -165,11 +163,16 @@ func (tail *Tail) tailFileSync(end bool, retry bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case <-tail.stop:
|
||||||
|
// stop the tailer if requested.
|
||||||
|
// FIXME: respect DRY (see below)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop the tailer if requested.
|
// stop the tailer if requested.
|
||||||
// FIXME: won't happen promptly; http://bugs.activestate.com/show_bug.cgi?id=95718#c3
|
|
||||||
select {
|
select {
|
||||||
case <-tail.stop:
|
case <-tail.stop:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue