Cleanup error output

master
xSmurf 10 years ago
parent ef3d65e744
commit eed82851f0

@ -199,22 +199,23 @@ func getSandboxById(id int) (*daemon.SandboxInfo, error) {
func handleKill(c *cli.Context) { func handleKill(c *cli.Context) {
if len(c.Args()) == 0 { if len(c.Args()) == 0 {
fmt.Errorf("Need a sandbox id to kill\n") fmt.Fprintf(os.Stderr, "Need a sandbox id to kill\n")
os.Exit(1) os.Exit(1)
} }
if c.Args()[0] == "all" { if c.Args()[0] == "all" {
if err := daemon.KillAllSandboxes(); err != nil { if err := daemon.KillAllSandboxes(); err != nil {
fmt.Errorf("Kill command failed:", err) fmt.Fprintf(os.Stderr, "Kill command failed:", err)
os.Exit(1)
} }
return
} }
id, err := strconv.Atoi(c.Args()[0]) id, err := strconv.Atoi(c.Args()[0])
if err != nil { if err != nil {
fmt.Errorf("Could not parse id value %s\n", c.Args()[0]) fmt.Fprintf(os.Stderr, "Could not parse id value %s\n", c.Args()[0])
os.Exit(1) os.Exit(1)
} }
if err := daemon.KillSandbox(id); err != nil { if err := daemon.KillSandbox(id); err != nil {
fmt.Errorf("Kill command failed:", err) fmt.Fprintf(os.Stderr, "Kill command failed:", err)
os.Exit(1)
} }
} }

Loading…
Cancel
Save