summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_linux.go
diff options
context:
space:
mode:
authorAditya Rajan <arajan@redhat.com>2021-11-23 16:37:31 +0530
committerAditya Rajan <arajan@redhat.com>2021-11-23 16:40:53 +0530
commit08558b27ffcd9e1fa6d4d31536e41c9acabebb25 (patch)
treeac95c73194d782b307bb1d02f380f8589d665d80 /libpod/oci_conmon_linux.go
parent90c635fd675bf9378e0ee0cbc7b95229bf9653e4 (diff)
downloadpodman-08558b27ffcd9e1fa6d4d31536e41c9acabebb25.tar.gz
podman-08558b27ffcd9e1fa6d4d31536e41c9acabebb25.tar.bz2
podman-08558b27ffcd9e1fa6d4d31536e41c9acabebb25.zip
oci: exit gracefully if container is already dead
While trying to kill a container with a `signal` we cant do anything if container is already dead so `exit` gracefully instead of trying to delete container again. Get container status from runtime. [ NO NEW TESTS NEEDED ] Signed-off-by: Aditya Rajan <arajan@redhat.com>
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r--libpod/oci_conmon_linux.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index bcf45ec8d..dee9634e1 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -407,6 +407,11 @@ func (r *ConmonOCIRuntime) KillContainer(ctr *Container, signal uint, all bool)
args = append(args, "kill", ctr.ID(), fmt.Sprintf("%d", signal))
}
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, env, r.path, args...); err != nil {
+ // try updating container state but ignore errors we cant do anything if this fails.
+ r.UpdateContainerStatus(ctr)
+ if ctr.state.State == define.ContainerStateExited {
+ return nil
+ }
return errors.Wrapf(err, "error sending signal to container %s", ctr.ID())
}