github.com/tsuna/docker@v1.7.0-rc3/api/client/unpause.go (about)

     1  package client
     2  
     3  import (
     4  	"fmt"
     5  
     6  	flag "github.com/docker/docker/pkg/mflag"
     7  )
     8  
     9  // CmdUnpause unpauses all processes within a container, for one or more containers.
    10  //
    11  // Usage: docker unpause CONTAINER [CONTAINER...]
    12  func (cli *DockerCli) CmdUnpause(args ...string) error {
    13  	cmd := cli.Subcmd("unpause", "CONTAINER [CONTAINER...]", "Unpause all processes within a container", true)
    14  	cmd.Require(flag.Min, 1)
    15  	cmd.ParseFlags(args, true)
    16  
    17  	var errNames []string
    18  	for _, name := range cmd.Args() {
    19  		if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/unpause", name), nil, nil)); err != nil {
    20  			fmt.Fprintf(cli.err, "%s\n", err)
    21  			errNames = append(errNames, name)
    22  		} else {
    23  			fmt.Fprintf(cli.out, "%s\n", name)
    24  		}
    25  	}
    26  	if len(errNames) > 0 {
    27  		return fmt.Errorf("Error: failed to unpause containers: %v", errNames)
    28  	}
    29  	return nil
    30  }