From 4a2c4c3989938ebc25a2d0d902aff51aaa5b6c45 Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Sat, 3 Oct 2020 21:45:38 +0800 Subject: Fix podman-remote ps --ns broken Signed-off-by: zhangguanzhang --- pkg/ps/ps.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pkg/ps') diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go index 8087507e2..96b2d754f 100644 --- a/pkg/ps/ps.go +++ b/pkg/ps/ps.go @@ -134,15 +134,16 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities logrus.Errorf("error getting exited time for %q: %v", c.ID(), err) } + pid, err = c.PID() + if err != nil { + return errors.Wrapf(err, "unable to obtain container pid") + } + if !opts.Size && !opts.Namespace { return nil } if opts.Namespace { - pid, err = c.PID() - if err != nil { - return errors.Wrapf(err, "unable to obtain container pid") - } ctrPID := strconv.Itoa(pid) cgroup, _ = getNamespaceInfo(filepath.Join("/proc", ctrPID, "ns", "cgroup")) ipc, _ = getNamespaceInfo(filepath.Join("/proc", ctrPID, "ns", "ipc")) -- cgit v1.2.3-54-g00ecf