mirror of
https://github.com/containers/podman.git
synced 2025-05-20 08:36:23 +08:00
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>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user