process line even if it doesn't end in newline

especially as we use ReadString now
This commit is contained in:
Sridhar Ratnakumar 2014-05-16 18:06:11 -07:00
parent 941cc3e301
commit 136cda4961
1 changed files with 2 additions and 1 deletions

View File

@ -213,7 +213,8 @@ func (tail *Tail) tailFileSync() {
for { for {
line, err := tail.readLine() line, err := tail.readLine()
if err == nil { // Process `line` even if err is EOF.
if err == nil || (err == io.EOF && line != "") {
cooloff := !tail.sendLine(line) cooloff := !tail.sendLine(line)
if cooloff { if cooloff {
// Wait a second before seeking till the end of // Wait a second before seeking till the end of