Browse code

fix stdout and stderr in api client Signed-off-by: allencloud <allen.sun@daocloud.io>

(cherry picked from commit 533bd82e41fee352962cb5ae0a49b9edbdebc25e)
Signed-off-by: Tibor Vass <tibor@docker.com>

allencloud authored on 2016/07/04 13:02:56
Showing 5 changed files
... ...
@@ -33,7 +33,7 @@ func runRemove(dockerCli *client.DockerCli, networks []string) error {
33 33
 			status = 1
34 34
 			continue
35 35
 		}
36
-		fmt.Fprintf(dockerCli.Err(), "%s\n", name)
36
+		fmt.Fprintf(dockerCli.Out(), "%s\n", name)
37 37
 	}
38 38
 
39 39
 	if status != 0 {
... ...
@@ -45,7 +45,7 @@ func runLogout(dockerCli *client.DockerCli, serverAddress string) error {
45 45
 
46 46
 	fmt.Fprintf(dockerCli.Out(), "Remove login credentials for %s\n", serverAddress)
47 47
 	if err := client.EraseCredentials(dockerCli.ConfigFile(), serverAddress); err != nil {
48
-		fmt.Fprintf(dockerCli.Out(), "WARNING: could not erase credentials: %v\n", err)
48
+		fmt.Fprintf(dockerCli.Err(), "WARNING: could not erase credentials: %v\n", err)
49 49
 	}
50 50
 
51 51
 	return nil
... ...
@@ -56,6 +56,8 @@ func runInit(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts initOptions
56 56
 	if err != nil {
57 57
 		return err
58 58
 	}
59
-	fmt.Printf("Swarm initialized: current node (%s) is now a manager.\n", nodeID)
59
+
60
+	fmt.Fprintf(dockerCli.Out(), "Swarm initialized: current node (%s) is now a manager.\n", nodeID)
61
+
60 62
 	return nil
61 63
 }
... ...
@@ -47,7 +47,8 @@ func runUpdate(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts swarmOpti
47 47
 		return err
48 48
 	}
49 49
 
50
-	fmt.Println("Swarm updated.")
50
+	fmt.Fprintln(dockerCli.Out(), "Swarm updated.")
51
+
51 52
 	return nil
52 53
 }
53 54
 
... ...
@@ -33,7 +33,7 @@ func runRemove(dockerCli *client.DockerCli, volumes []string) error {
33 33
 			status = 1
34 34
 			continue
35 35
 		}
36
-		fmt.Fprintf(dockerCli.Err(), "%s\n", name)
36
+		fmt.Fprintf(dockerCli.Out(), "%s\n", name)
37 37
 	}
38 38
 
39 39
 	if status != 0 {