mirror of
https://github.com/walles/moar.git
synced 2024-11-22 21:50:43 +03:00
27817741fc
Before this change, if the file grew after we read it, but before we noted its size, then tailing could misbehave.
16 lines
283 B
Go
16 lines
283 B
Go
package m
|
|
|
|
import "io"
|
|
|
|
// Pass-through reader that counts the number of bytes read.
|
|
type inspectionReader struct {
|
|
base io.Reader
|
|
bytesCount int64
|
|
}
|
|
|
|
func (r *inspectionReader) Read(p []byte) (n int, err error) {
|
|
n, err = r.base.Read(p)
|
|
r.bytesCount += int64(n)
|
|
return
|
|
}
|