aboutsummaryrefslogtreecommitdiff
path: root/pkg/ps
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-10-06 11:17:43 -0400
committerMatthew Heon <mheon@redhat.com>2021-10-06 11:19:32 -0400
commit8bd9f58d1d0db76406dca53907095648f4091f9f (patch)
treee01204cca664c9e2ca860d12fbcbbbb9faa942de /pkg/ps
parente1089e89d7b8f5204ccb226934e46df736af4925 (diff)
downloadpodman-8bd9f58d1d0db76406dca53907095648f4091f9f.tar.gz
podman-8bd9f58d1d0db76406dca53907095648f4091f9f.tar.bz2
podman-8bd9f58d1d0db76406dca53907095648f4091f9f.zip
Ensure `podman ps --sync` functions
The backend for `ps --sync` has been nonfunctional for a long while now - probably since v2.0. It's questionable how useful the flag is in modern Podman (the original case it was intended to catch, Conmon gone via SIGKILL, should be handled now via pinging the process with a signal to ensure it's still alive) but having the ability to force a refresh of container state from the OCI runtime is still useful. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'pkg/ps')
-rw-r--r--pkg/ps/ps.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go
index 69ac9c215..90ad23f49 100644
--- a/pkg/ps/ps.go
+++ b/pkg/ps/ps.go
@@ -136,6 +136,12 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
)
batchErr := ctr.Batch(func(c *libpod.Container) error {
+ if opts.Sync {
+ if err := c.Sync(); err != nil {
+ return errors.Wrapf(err, "unable to update container state from OCI runtime")
+ }
+ }
+
conConfig = c.Config()
conState, err = c.State()
if err != nil {