Close done channel if the wait for ContainerStateStopped times out
@@ -146,9 +146,11 @@ func (r *Runtime) WaitContainerStateStopped(ctx context.Context, c *Container) (
break
case <-ctx.Done():
close(chControl)
+ close(done)
return ctx.Err()
case <-time.After(time.Duration(r.config.CtrStopTimeout) * time.Second):
close(chControl)
+ close(done)
return fmt.Errorf(
"failed to get container stopped status: %ds timeout reached",
r.config.CtrStopTimeout,
