From b5184d3c2417c743b3fec34312270d243e4d980c Mon Sep 17 00:00:00 2001 From: Phil Estes Date: Sat, 6 Sep 2014 00:16:24 -0400 Subject: [PATCH] Fix gh#7747 - filter bare newline output and log client pull to stdout Docker-DCO-1.1-Signed-off-by: Phil Estes (github: estesp) --- api/client/commands.go | 2 +- utils/jsonmessage.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/client/commands.go b/api/client/commands.go index 4a5f2faea8..a2c241dd8b 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -1993,7 +1993,7 @@ func (cli *DockerCli) pullImage(image string) error { registryAuthHeader := []string{ base64.URLEncoding.EncodeToString(buf), } - if err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.err, map[string][]string{"X-Registry-Auth": registryAuthHeader}); err != nil { + if err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.out, map[string][]string{"X-Registry-Auth": registryAuthHeader}); err != nil { return err } return nil diff --git a/utils/jsonmessage.go b/utils/jsonmessage.go index e22d06eccd..940a4c06db 100644 --- a/utils/jsonmessage.go +++ b/utils/jsonmessage.go @@ -143,7 +143,9 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, if !ok { line = len(ids) ids[jm.ID] = line - fmt.Fprintf(out, "\n") + if isTerminal { + fmt.Fprintf(out, "\n") + } diff = 0 } else { diff = len(ids) - line