flori / file-tail

File::Tail for Ruby
http://flori.github.com/file-tail
Apache License 2.0
160 stars 19 forks source link

After logrotate(copytruncate), file-tail can't read line for a while #9

Closed xqjcool1 closed 7 years ago

xqjcool1 commented 7 years ago

After logrotate(copytruncate), file-tail can't read line for a while. for example: I tail a system.log using shell tail. after logrotate , it works well. I tail a system.log using ruby file-tail. after logrotate, sometimes it can't read line for a while

xqjcool1 commented 7 years ago

we should update @stat=stat even if @stat is existing I encounted the situation as below: file-tail is tailing the system.log, the @stat.size is 0. after logrotate copytruncate the system.log. file-tail readline and throw a EOF, the restat method doesn't trigger the ReopenException because the @stat.size is 0. It will never enter the judgement "stat.size < @stat.size"

xqjcool1 commented 7 years ago

I resolve it on fork branch.