aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-05-03 15:16:53 +0200
committerGitHub <noreply@github.com>2019-05-03 15:16:53 +0200
commit0eaba2d56a48c68e1d08e287a1c9eb5405cc743a (patch)
tree29f4b20794d7c69ecebd3f71aa4491a13034b406 /libpod
parenta7809fabe508e26c527490e700a1703ef923bd3b (diff)
parent0d2d52339058a19e66ecc75f78c52596054c7dad (diff)
downloadpodman-0eaba2d56a48c68e1d08e287a1c9eb5405cc743a.tar.gz
podman-0eaba2d56a48c68e1d08e287a1c9eb5405cc743a.tar.bz2
podman-0eaba2d56a48c68e1d08e287a1c9eb5405cc743a.zip
Merge pull request #3034 from vrothberg/top-fallback
top: fallback to execing ps(1)
Diffstat (limited to 'libpod')
-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.