summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/containers/kill.go9
-rw-r--r--test/system/130-kill.bats14
2 files changed, 20 insertions, 3 deletions
diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go
index 449484449..fe4083df8 100644
--- a/cmd/podman/containers/kill.go
+++ b/cmd/podman/containers/kill.go
@@ -108,10 +108,13 @@ func kill(_ *cobra.Command, args []string) error {
return err
}
for _, r := range responses {
- if r.Err == nil {
- fmt.Println(r.RawInput)
- } else {
+ switch {
+ case r.Err != nil:
errs = append(errs, r.Err)
+ case r.RawInput != "":
+ fmt.Println(r.RawInput)
+ default:
+ fmt.Println(r.Id)
}
}
return errs.PrintErrors()
diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats
index 1ff3a7b61..a9456e03c 100644
--- a/test/system/130-kill.bats
+++ b/test/system/130-kill.bats
@@ -116,4 +116,18 @@ load helpers
is "$output" "Error: valid signals are 1 through 64" "podman create"
}
+@test "podman kill - print IDs or raw input" {
+ # kill -a must print the IDs
+ run_podman run --rm -d $IMAGE top
+ ctrID="$output"
+ run_podman kill -a
+ is "$output" "$ctrID"
+
+ # kill $input must print $input
+ cname=$(random_string)
+ run_podman run --rm -d --name $cname $IMAGE top
+ run_podman kill $cname
+ is "$output" $cname
+}
+
# vim: filetype=sh