summaryrefslogtreecommitdiff
path: root/libpod/container_top_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/container_top_linux.go')
-rw-r--r--libpod/container_top_linux.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/libpod/container_top_linux.go b/libpod/container_top_linux.go
index b370495fe..392a7029e 100644
--- a/libpod/container_top_linux.go
+++ b/libpod/container_top_linux.go
@@ -20,14 +20,24 @@ func (c *Container) Top(descriptors []string) ([]string, error) {
if conStat != ContainerStateRunning {
return nil, errors.Errorf("top can only be used on running containers")
}
- return c.GetContainerPidInformation(descriptors)
+
+ // Also support comma-separated input.
+ psgoDescriptors := []string{}
+ for _, d := range descriptors {
+ for _, s := range strings.Split(d, ",") {
+ if s != "" {
+ psgoDescriptors = append(psgoDescriptors, s)
+ }
+ }
+ }
+ return c.GetContainerPidInformation(psgoDescriptors)
}
// GetContainerPidInformation returns process-related data of all processes in
// the container. The output data can be controlled via the `descriptors`
// argument which expects format descriptors and supports all AIXformat
// descriptors of ps (1) plus some additional ones to for instance inspect the
-// set of effective capabilities. Eeach element in the returned string slice
+// set of effective capabilities. Each element in the returned string slice
// is a tab-separated string.
//
// For more details, please refer to github.com/containers/psgo.