We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ce725b commit ceb07beCopy full SHA for ceb07be
cmd/head-main.go
@@ -22,6 +22,7 @@ import (
22
"compress/bzip2"
23
"compress/gzip"
24
"context"
25
+ "errors"
26
"io"
27
"os"
28
"strings"
@@ -142,9 +143,12 @@ func headOut(r io.Reader, nlines int64) *probe.Error {
142
143
}
144
145
for nlines > 0 {
- line, _, e := br.ReadLine()
146
- if e != nil {
147
- return probe.NewError(e)
+ line, _, err := br.ReadLine()
+ if err != nil && !errors.Is(err, io.EOF) {
148
+ return probe.NewError(err)
149
+ }
150
+ if errors.Is(err, io.EOF) {
151
+ break
152
153
if _, e := stdout.Write(line); e != nil {
154
switch e := e.(type) {
0 commit comments