summaryrefslogtreecommitdiff
path: root/pkg/ps
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-10-06 11:17:43 -0400
committerMatthew Heon <matthew.heon@pm.me>2021-10-19 14:13:59 -0400
commitca33df1468b79dc6dc27798a242b22926c220e6d (patch)
tree6dc510a6d85d423b1cff07e2c75c036b8997dad5 /pkg/ps
parent7bbf774e858fa3e535d9d22d72836459608eb095 (diff)
downloadpodman-ca33df1468b79dc6dc27798a242b22926c220e6d.tar.gz
podman-ca33df1468b79dc6dc27798a242b22926c220e6d.tar.bz2
podman-ca33df1468b79dc6dc27798a242b22926c220e6d.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 e65400555..21ce818cb 100644
--- a/pkg/ps/ps.go
+++ b/pkg/ps/ps.go
@@ -127,6 +127,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 {