diff --git a/commands.go b/commands.go index e24b7aeece..19e7110e9d 100644 --- a/commands.go +++ b/commands.go @@ -228,6 +228,8 @@ func (cli *DockerCli) CmdBuild(args ...string) error { if context != nil { headers.Set("Content-Type", "application/tar") } + // Temporary hack to fix displayJSON behavior + cli.isTerminal = false err = cli.stream("POST", fmt.Sprintf("/build?%s", v.Encode()), body, cli.out, headers) if jerr, ok := err.(*utils.JSONError); ok { return &utils.StatusError{Status: jerr.Message, StatusCode: jerr.Code} diff --git a/utils/jsonmessage.go b/utils/jsonmessage.go index a0aeba2e7a..be74033f7f 100644 --- a/utils/jsonmessage.go +++ b/utils/jsonmessage.go @@ -63,7 +63,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { if isTerminal { // [2K = erase entire current line fmt.Fprintf(out, "%c[2K\r", 27) - endl = "\r" + endl = "\r\n" } if jm.Time != 0 { fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0)) @@ -79,7 +79,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { } else if jm.ProgressMessage != "" { //deprecated fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl) } else { - fmt.Fprintf(out, "%s%s\n", jm.Status, endl) + fmt.Fprintf(out, "%s%s", jm.Status, endl) } return nil }