Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logReadCloser: ensure EOF after Close() #3034

Merged
merged 2 commits into from
Jan 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions probe/kubernetes/logreadcloser.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (l *logReadCloser) Read(p []byte) (int, error) {

// check if there's more data to read, without blocking
empty := false
for !empty && l.buffer.Len() < len(p) {
for !empty && l.buffer.Len() < len(p) && !l.isEOF() {
select {
case data := <-l.dataChannel:
l.buffer.Write(data)
Expand Down Expand Up @@ -130,7 +130,6 @@ func (l *logReadCloser) readInput(idx int) {
if len(line) > 0 {
l.dataChannel <- l.annotateLine(idx, line)
}
l.eofChannel <- idx
break
}
if err != nil {
Expand All @@ -139,6 +138,8 @@ func (l *logReadCloser) readInput(idx int) {
}
l.dataChannel <- l.annotateLine(idx, line)
}

l.eofChannel <- idx
}

func (l *logReadCloser) annotateLine(idx int, line []byte) []byte {
Expand Down