Skip to content

Commit 15b422b

Browse files
committed
cli/command/container: RunStats: handle context-cancellation
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 832fc66 commit 15b422b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cli/command/container/stats.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions)
192192
select {
193193
case <-stopped:
194194
return
195+
case <-ctx.Done():
196+
return
195197
case event := <-eventChan:
196198
c <- event
197199
case err := <-errChan:
@@ -336,6 +338,8 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions)
336338
return nil
337339
}
338340
return err
341+
case <-ctx.Done():
342+
return ctx.Err()
339343
}
340344
}
341345
}

0 commit comments

Comments
 (0)