(ctx context.Context, dockerCLI command.Cli, opts *killOptions)
| 46 | } |
| 47 | |
| 48 | func runKill(ctx context.Context, dockerCLI command.Cli, opts *killOptions) error { |
| 49 | apiClient := dockerCLI.Client() |
| 50 | errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error { |
| 51 | _, err := apiClient.ContainerKill(ctx, container, client.ContainerKillOptions{ |
| 52 | Signal: opts.signal, |
| 53 | }) |
| 54 | return err |
| 55 | }) |
| 56 | |
| 57 | var errs []error |
| 58 | for _, name := range opts.containers { |
| 59 | if err := <-errChan; err != nil { |
| 60 | errs = append(errs, err) |
| 61 | continue |
| 62 | } |
| 63 | _, _ = fmt.Fprintln(dockerCLI.Out(), name) |
| 64 | } |
| 65 | return errors.Join(errs...) |
| 66 | } |
no test coverage detected
searching dependent graphs…