diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-07-08 15:17:43 +0200 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-07-11 13:06:40 +0200 |
commit | 62cdc387de982feb796af71252a3fe3d504d570c (patch) | |
tree | ddedeb03b891c61ac375adf7d9c2fac9d65b092e /libpod/container_api.go | |
parent | b41e42f42b59ea3b3b91a97bf89d7898d32e0861 (diff) | |
download | podman-62cdc387de982feb796af71252a3fe3d504d570c.tar.gz podman-62cdc387de982feb796af71252a3fe3d504d570c.tar.bz2 podman-62cdc387de982feb796af71252a3fe3d504d570c.zip |
podman wait: return 0 if container never ran
Make sure to return/exit with 0 when waiting for a container that never
ran.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index dbd5fc1fb..742eb6d3e 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -551,6 +551,10 @@ func (c *Container) WaitForExit(ctx context.Context, pollInterval time.Duration) exitCode, err := c.runtime.state.GetContainerExitCode(id) if err != nil { + if errors.Is(err, define.ErrNoSuchExitCode) && c.ensureState(define.ContainerStateConfigured, define.ContainerStateCreated) { + // The container never ran. + return true, 0, nil + } return true, -1, err } |