1
1
mirror of https://github.com/walles/moar.git synced 2024-07-14 15:20:29 +03:00

Only report first byte on read success

This commit is contained in:
Johan Walles 2024-03-18 18:06:10 +01:00
parent 350c370db6
commit f05d6a0e83

View File

@ -126,13 +126,14 @@ func (reader *Reader) readStream(stream io.Reader, originalFileName *string, onD
for keepReadingLine {
lineBytes, keepReadingLine, err = bufioReader.ReadLine()
// Async write, it might already have been written to
select {
case reader.doneWaitingForFirstByte <- true:
default:
}
if err == nil {
// Async write, we probably already wrote to it during the last
// iteration
select {
case reader.doneWaitingForFirstByte <- true:
default:
}
completeLine = append(completeLine, lineBytes...)
continue
}