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:
Valentin Rothberg
2022-07-08 15:17:43 +02:00
parent b41e42f42b
commit 62cdc387de
3 changed files with 16 additions and 1 deletions

View File

@ -303,7 +303,7 @@ func (r *ConmonOCIRuntime) UpdateContainerStatus(ctr *Container) error {
ctr.state.ExitCode = -1
ctr.state.FinishedTime = time.Now()
ctr.state.State = define.ContainerStateExited
return nil
return ctr.runtime.state.AddContainerExitCode(ctr.ID(), ctr.state.ExitCode)
}
return fmt.Errorf("error getting container %s state. stderr/out: %s: %w", ctr.ID(), out, err)
}