summaryrefslogtreecommitdiff
path: root/pkg/ps/ps.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ps/ps.go')
-rw-r--r--pkg/ps/ps.go9
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"))