(ctx context.Context, opts KillOptions, services []string)
| 29 | } |
| 30 | |
| 31 | func (c *Composer) Kill(ctx context.Context, opts KillOptions, services []string) error { |
| 32 | serviceNames, err := c.ServiceNames(services...) |
| 33 | if err != nil { |
| 34 | return err |
| 35 | } |
| 36 | containers, err := c.Containers(ctx, serviceNames...) |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | eg, ctx := errgroup.WithContext(ctx) |
| 41 | for _, container := range containers { |
| 42 | container := container |
| 43 | eg.Go(func() error { |
| 44 | args := []string{"kill", "-s", opts.Signal, container.ID()} |
| 45 | if err := c.runNerdctlCmd(ctx, args...); err != nil { |
| 46 | log.G(ctx).Warn(err) |
| 47 | return err |
| 48 | } |
| 49 | return nil |
| 50 | }) |
| 51 | } |
| 52 | return eg.Wait() |
| 53 | } |
nothing calls this directly
no test coverage detected