diff options
author | Aditya Rajan <arajan@redhat.com> | 2021-11-23 16:37:31 +0530 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-12-06 15:20:21 -0500 |
commit | c5530591bbed4788fa0a113430b767a593cc0782 (patch) | |
tree | 68770ae1f8def68011d36b4674fde5ea8e9362bb | |
parent | 4a7af72ea95bd6ebba19db8d052527c5beb9c0eb (diff) | |
download | podman-c5530591bbed4788fa0a113430b767a593cc0782.tar.gz podman-c5530591bbed4788fa0a113430b767a593cc0782.tar.bz2 podman-c5530591bbed4788fa0a113430b767a593cc0782.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>
-rw-r--r-- | libpod/oci_conmon_linux.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index ea0ef842d..74b5bc20b 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -399,6 +399,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()) } |