summaryrefslogtreecommitdiff
path: root/libpod/container_exec.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-05-19 14:49:26 -0400
committerMatthew Heon <mheon@redhat.com>2021-06-10 14:16:22 -0400
commit341e6a1628a35198500fcfc1bb65b377ff9b270b (patch)
tree2a9dee91477e9f09b5dfd4212c110ed8d8dfcaaf /libpod/container_exec.go
parent2aedcae02683390b340e52d342c55277d604df67 (diff)
downloadpodman-341e6a1628a35198500fcfc1bb65b377ff9b270b.tar.gz
podman-341e6a1628a35198500fcfc1bb65b377ff9b270b.tar.bz2
podman-341e6a1628a35198500fcfc1bb65b377ff9b270b.zip
Always spawn a cleanup process with exec
We were previously only doing this for detached exec. I don't know why we did that, but I don't see any reason not to extend it to all exec sessions - it guarantees that we will always clean up exec sessions, even if the original `podman exec` process died. [NO TESTS NEEDED] because I don't really know how to test this one. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/container_exec.go')
-rw-r--r--libpod/container_exec.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index c359f1e5d..09a5b9597 100644
--- a/libpod/container_exec.go
+++ b/libpod/container_exec.go
@@ -761,6 +761,9 @@ func (c *Container) Exec(config *ExecConfig, streams *define.AttachStreams, resi
}
exitCode := session.ExitCode
if err := c.ExecRemove(sessionID, false); err != nil {
+ if errors.Cause(err) == define.ErrNoSuchExecSession {
+ return exitCode, nil
+ }
return -1, err
}