diff options
author | zhangguanzhang <zhangguanzhang@qq.com> | 2020-10-03 21:45:38 +0800 |
---|---|---|
committer | zhangguanzhang <zhangguanzhang@qq.com> | 2020-10-04 19:48:13 +0800 |
commit | 4a2c4c3989938ebc25a2d0d902aff51aaa5b6c45 (patch) | |
tree | bf312725a0e358d6c19c1424e0976f15864488d0 /pkg/ps/ps.go | |
parent | 7c12967257742063206c05f0baec517bc08cbeb6 (diff) | |
download | podman-4a2c4c3989938ebc25a2d0d902aff51aaa5b6c45.tar.gz podman-4a2c4c3989938ebc25a2d0d902aff51aaa5b6c45.tar.bz2 podman-4a2c4c3989938ebc25a2d0d902aff51aaa5b6c45.zip |
Fix podman-remote ps --ns broken
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'pkg/ps/ps.go')
-rw-r--r-- | pkg/ps/ps.go | 9 |
1 files changed, 5 insertions, 4 deletions
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")) |