Browse code

Merge pull request #7942 from estesp/7747-stderr-stdout-bug

Fix gh#7747: filter bare newline output and log client pull to stdout

Victor Vieux authored on 2014/09/23 02:53:34
Showing 2 changed files
... ...
@@ -1967,7 +1967,7 @@ func (cli *DockerCli) pullImage(image string) error {
1967 1967
 	registryAuthHeader := []string{
1968 1968
 		base64.URLEncoding.EncodeToString(buf),
1969 1969
 	}
1970
-	if err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.err, map[string][]string{"X-Registry-Auth": registryAuthHeader}); err != nil {
1970
+	if err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.out, map[string][]string{"X-Registry-Auth": registryAuthHeader}); err != nil {
1971 1971
 		return err
1972 1972
 	}
1973 1973
 	return nil
... ...
@@ -144,7 +144,9 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr,
144 144
 			if !ok {
145 145
 				line = len(ids)
146 146
 				ids[jm.ID] = line
147
-				fmt.Fprintf(out, "\n")
147
+				if isTerminal {
148
+					fmt.Fprintf(out, "\n")
149
+				}
148 150
 				diff = 0
149 151
 			} else {
150 152
 				diff = len(ids) - line