Fix cli echoing container ID on start -a|-i

The cli now doesn't echo the container ID when started using either -a
or -i. Also fixes `TestStartAttachCorrectExitCode` which incorrectly
called start with the result of wait rather than the container ID.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: eeefa2dc8c45a9be4cfb3a52029e6b46570e5ebe
Component: engine
This commit is contained in:
Arnaud Porterie
2015-01-06 17:58:30 -08:00
parent e576cc5858
commit fee739749d
2 changed files with 32 additions and 4 deletions

View File

@ -707,12 +707,12 @@ func (cli *DockerCli) CmdStart(args ...string) error {
for _, name := range cmd.Args() {
_, _, err := readBody(cli.call("POST", "/containers/"+name+"/start", nil, false))
if err != nil {
if !*attach || !*openStdin {
if !*attach && !*openStdin {
fmt.Fprintf(cli.err, "%s\n", err)
}
encounteredError = fmt.Errorf("Error: failed to start one or more containers")
} else {
if !*attach || !*openStdin {
if !*attach && !*openStdin {
fmt.Fprintf(cli.out, "%s\n", name)
}
}