fix problem of long line EOF
This commit is contained in:
parent
24d682e8af
commit
7ccd8397a1
11
tail.go
11
tail.go
|
@ -170,8 +170,17 @@ func (tail *Tail) reopen() error {
|
|||
}
|
||||
|
||||
func (tail *Tail) readLine() ([]byte, error) {
|
||||
line, _, err := tail.reader.ReadLine()
|
||||
line, isPrefix, err := tail.reader.ReadLine()
|
||||
if !isPrefix {
|
||||
return line, err
|
||||
}
|
||||
|
||||
buf := append([]byte(nil), line...)
|
||||
for isPrefix && err == nil {
|
||||
line, isPrefix, err = tail.reader.ReadLine()
|
||||
buf = append(buf, line...)
|
||||
}
|
||||
return buf, err
|
||||
}
|
||||
|
||||
func (tail *Tail) tailFileSync() {
|
||||
|
|
Loading…
Reference in New Issue