mirror of https://github.com/docker/cli.git
Add parallel operation support for pause/unpause
Support parallel pause/unpause Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
parent
285fef282f
commit
4570bfe8de
|
@ -34,8 +34,9 @@ func runPause(dockerCli *command.DockerCli, opts *pauseOptions) error {
|
|||
ctx := context.Background()
|
||||
|
||||
var errs []string
|
||||
errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerPause)
|
||||
for _, container := range opts.containers {
|
||||
if err := dockerCli.Client().ContainerPause(ctx, container); err != nil {
|
||||
if err := <-errChan; err != nil {
|
||||
errs = append(errs, err.Error())
|
||||
} else {
|
||||
fmt.Fprintf(dockerCli.Out(), "%s\n", container)
|
||||
|
|
|
@ -35,8 +35,9 @@ func runUnpause(dockerCli *command.DockerCli, opts *unpauseOptions) error {
|
|||
ctx := context.Background()
|
||||
|
||||
var errs []string
|
||||
errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerUnpause)
|
||||
for _, container := range opts.containers {
|
||||
if err := dockerCli.Client().ContainerUnpause(ctx, container); err != nil {
|
||||
if err := <-errChan; err != nil {
|
||||
errs = append(errs, err.Error())
|
||||
} else {
|
||||
fmt.Fprintf(dockerCli.Out(), "%s\n", container)
|
||||
|
|
Loading…
Reference in New Issue