From 5860dd5f80b842fe026542118eb565c20189a7d2 Mon Sep 17 00:00:00 2001 From: Xianglin Gao Date: Wed, 28 Dec 2016 16:28:32 +0800 Subject: [PATCH] exit collect when we get EOF Signed-off-by: Xianglin Gao --- command/container/stats_helpers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command/container/stats_helpers.go b/command/container/stats_helpers.go index 4b57e3fe05..4a58134a4e 100644 --- a/command/container/stats_helpers.go +++ b/command/container/stats_helpers.go @@ -155,11 +155,13 @@ func collect(ctx context.Context, s *formatter.ContainerStats, cli client.APICli waitFirst.Done() } case err := <-u: + s.SetError(err) + if err == io.EOF { + break + } if err != nil { - s.SetError(err) continue } - s.SetError(nil) // if this is the first stat you get, release WaitGroup if !getFirst { getFirst = true