mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
logReadCloser: ensure loop terminates if channels are closed
Adding the !EOF check to the loop condition ensures not reading from closed channels.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user