|
|
|
@ -199,22 +199,23 @@ func getSandboxById(id int) (*daemon.SandboxInfo, error) {
|
|
|
|
|
|
|
|
|
|
func handleKill(c *cli.Context) {
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
if c.Args()[0] == "all" {
|
|
|
|
|
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])
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
if err := daemon.KillSandbox(id); err != nil {
|
|
|
|
|
fmt.Errorf("Kill command failed:", err)
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Kill command failed:", err)
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|