Sfoglia il codice sorgente

Merge pull request #29747 from xlgao-zju/break-the-for

exit collect when we get EOF
Vincent Demeester 8 anni fa
parent
commit
3c64061b67
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      cli/command/container/stats_helpers.go

+ 4 - 2
cli/command/container/stats_helpers.go

@@ -152,11 +152,13 @@ func collect(ctx context.Context, s *formatter.ContainerStats, cli client.APICli
 				waitFirst.Done()
 				waitFirst.Done()
 			}
 			}
 		case err := <-u:
 		case err := <-u:
+			s.SetError(err)
+			if err == io.EOF {
+				break
+			}
 			if err != nil {
 			if err != nil {
-				s.SetError(err)
 				continue
 				continue
 			}
 			}
-			s.SetError(nil)
 			// if this is the first stat you get, release WaitGroup
 			// if this is the first stat you get, release WaitGroup
 			if !getFirst {
 			if !getFirst {
 				getFirst = true
 				getFirst = true