Merge pull request #1636 from unclejack/1594-return_non_zero_when_encountering_error

1594 - return non-zero exit code if at least one container has failed to start
This commit is contained in:
Michael Crosby 2013-08-26 13:20:31 -07:00
commit b866254a19
1 changed files with 3 additions and 1 deletions

View File

@ -584,15 +584,17 @@ func (cli *DockerCli) CmdStart(args ...string) error {
return nil return nil
} }
var encounteredError error
for _, name := range args { for _, name := range args {
_, _, err := cli.call("POST", "/containers/"+name+"/start", nil) _, _, err := cli.call("POST", "/containers/"+name+"/start", nil)
if err != nil { if err != nil {
fmt.Fprintf(cli.err, "%s\n", err) fmt.Fprintf(cli.err, "%s\n", err)
encounteredError = fmt.Errorf("Error: failed to start one or more containers")
} else { } else {
fmt.Fprintf(cli.out, "%s\n", name) fmt.Fprintf(cli.out, "%s\n", name)
} }
} }
return nil return encounteredError
} }
func (cli *DockerCli) CmdInspect(args ...string) error { func (cli *DockerCli) CmdInspect(args ...string) error {