MCPcopy Create free account
hub / github.com/containerd/nerdctl / waitContainerStop

Function waitContainerStop

pkg/containerutil/containerutil.go:483–499  ·  view source on GitHub ↗
(ctx context.Context, task containerd.Task, exitCh <-chan containerd.ExitStatus, id string)

Source from the content-addressed store, hash-verified

481}
482
483func waitContainerStop(ctx context.Context, task containerd.Task, exitCh <-chan containerd.ExitStatus, id string) error {
484 select {
485 case <-ctx.Done():
486 if err := ctx.Err(); err != nil {
487 return fmt.Errorf("wait container %v: %w", id, err)
488 }
489 return nil
490 case status := <-exitCh:
491 // Cleanup the IO after a successful Stop
492 if io := task.IO(); io != nil {
493 if cerr := io.Close(); cerr != nil {
494 log.G(ctx).Warnf("failed to close IO for container %s: %v", id, cerr)
495 }
496 }
497 return status.Error()
498 }
499}
500
501// Pause pauses a container by its id.
502func Pause(ctx context.Context, client *containerd.Client, id string) error {

Callers 1

StopFunction · 0.85

Calls 3

ErrMethod · 0.65
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…