aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-09 12:22:08 -0400
committerGitHub <noreply@github.com>2020-09-09 12:22:08 -0400
commit9c4c883d7976a3bd72aef9b9bb8e8757959f4fe4 (patch)
treedfd3bb592779b338528f384d0ce190f6782b8a4e /pkg
parent49cb0edd651848d1e731b77412ed9d47a34fe0a7 (diff)
parent0533bc3588f2c295ed35dacb06a1818bc6cf0899 (diff)
downloadpodman-9c4c883d7976a3bd72aef9b9bb8e8757959f4fe4.tar.gz
podman-9c4c883d7976a3bd72aef9b9bb8e8757959f4fe4.tar.bz2
podman-9c4c883d7976a3bd72aef9b9bb8e8757959f4fe4.zip
Merge pull request #7572 from vrothberg/fix-7135
remote kill: don't wait for the container to stop
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/containers.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index 1ae6a990b..b1ef08cda 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"strings"
+ "syscall"
"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/libpod/define"
@@ -169,16 +170,16 @@ func KillContainer(w http.ResponseWriter, r *http.Request) {
return
}
- err = con.Kill(uint(sig))
+ signal := uint(sig)
+
+ err = con.Kill(signal)
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "unable to kill Container %s", name))
}
- if utils.IsLibpodRequest(r) {
- // the kill behavior for docker differs from podman in that they appear to wait
- // for the Container to croak so the exit code is accurate immediately after the
- // kill is sent. libpod does not. but we can add a wait here only for the docker
- // side of things and mimic that behavior
+ // Docker waits for the container to stop if the signal is 0 or
+ // SIGKILL.
+ if !utils.IsLibpodRequest(r) && (signal == 0 || syscall.Signal(signal) == syscall.SIGKILL) {
if _, err = con.Wait(); err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to wait for Container %s", con.ID()))
return