diff --git a/cmd/client.go b/cmd/client.go index 65ed49fd3d1..ba99bbd22e3 100644 --- a/cmd/client.go +++ b/cmd/client.go @@ -282,9 +282,9 @@ func loop() { command.SetArgs(args) _ = command.ParseFlags(args) command.SetOut(os.Stdout) - command.SetErr(os.Stdout) + command.SetErr(os.Stderr) if err = command.Execute(); err != nil { - command.Println(err) + command.PrintErr(err.Error() + "\n") } } } diff --git a/cmd/root.go b/cmd/root.go index fb44cf4526c..878ceda631b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -31,7 +31,7 @@ func Execute() { // Outputs cmd.Print to stdout. rootCmd.SetOut(os.Stdout) if err := rootCmd.Execute(); err != nil { - rootCmd.Println(err) + rootCmd.PrintErr(err.Error() + "\n") os.Exit(1) } }