Exit with code 1 in case of error for docker build

Upstream-commit: 4986958e7e61bb0439a59c46af000b157798b94a
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-12-26 17:49:41 -08:00
parent 93558ee08f
commit 63c010af99

View File

@ -12,8 +12,8 @@ import (
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/auth"
"github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/registry"
"github.com/dotcloud/docker/pkg/term"
"github.com/dotcloud/docker/registry"
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
@ -238,6 +238,10 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
}
err = cli.stream("POST", fmt.Sprintf("/build?%s", v.Encode()), body, cli.out, headers)
if jerr, ok := err.(*utils.JSONError); ok {
// If no error code is set, default to 1
if jerr.Code == 0 {
jerr.Code = 1
}
return &utils.StatusError{Status: jerr.Message, StatusCode: jerr.Code}
}
return err