Browse Source

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

allencloud 9 years ago
parent
commit
533bd82e41

+ 1 - 1
api/client/network/remove.go

@@ -33,7 +33,7 @@ func runRemove(dockerCli *client.DockerCli, networks []string) error {
 			status = 1
 			status = 1
 			continue
 			continue
 		}
 		}
-		fmt.Fprintf(dockerCli.Err(), "%s\n", name)
+		fmt.Fprintf(dockerCli.Out(), "%s\n", name)
 	}
 	}
 
 
 	if status != 0 {
 	if status != 0 {

+ 1 - 1
api/client/registry/logout.go

@@ -45,7 +45,7 @@ func runLogout(dockerCli *client.DockerCli, serverAddress string) error {
 
 
 	fmt.Fprintf(dockerCli.Out(), "Remove login credentials for %s\n", serverAddress)
 	fmt.Fprintf(dockerCli.Out(), "Remove login credentials for %s\n", serverAddress)
 	if err := client.EraseCredentials(dockerCli.ConfigFile(), serverAddress); err != nil {
 	if err := client.EraseCredentials(dockerCli.ConfigFile(), serverAddress); err != nil {
-		fmt.Fprintf(dockerCli.Out(), "WARNING: could not erase credentials: %v\n", err)
+		fmt.Fprintf(dockerCli.Err(), "WARNING: could not erase credentials: %v\n", err)
 	}
 	}
 
 
 	return nil
 	return nil

+ 3 - 1
api/client/swarm/init.go

@@ -56,6 +56,8 @@ func runInit(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts initOptions
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}
-	fmt.Printf("Swarm initialized: current node (%s) is now a manager.\n", nodeID)
+
+	fmt.Fprintf(dockerCli.Out(), "Swarm initialized: current node (%s) is now a manager.\n", nodeID)
+
 	return nil
 	return nil
 }
 }

+ 2 - 1
api/client/swarm/update.go

@@ -47,7 +47,8 @@ func runUpdate(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts swarmOpti
 		return err
 		return err
 	}
 	}
 
 
-	fmt.Println("Swarm updated.")
+	fmt.Fprintln(dockerCli.Out(), "Swarm updated.")
+
 	return nil
 	return nil
 }
 }
 
 

+ 1 - 1
api/client/volume/remove.go

@@ -33,7 +33,7 @@ func runRemove(dockerCli *client.DockerCli, volumes []string) error {
 			status = 1
 			status = 1
 			continue
 			continue
 		}
 		}
-		fmt.Fprintf(dockerCli.Err(), "%s\n", name)
+		fmt.Fprintf(dockerCli.Out(), "%s\n", name)
 	}
 	}
 
 
 	if status != 0 {
 	if status != 0 {