summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@suse.com>2018-07-26 15:26:52 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-26 17:01:40 +0000
commit159f7f179bf63dee2710680a12164d7487e7e696 (patch)
treed3defe9fbb39411ba8dd6dd252815de62ddc824a /libpod
parentd9ae17400d40403134f7cb484a7cb5e14fa02635 (diff)
downloadpodman-159f7f179bf63dee2710680a12164d7487e7e696.tar.gz
podman-159f7f179bf63dee2710680a12164d7487e7e696.tar.bz2
podman-159f7f179bf63dee2710680a12164d7487e7e696.zip
vendor latest containers/psgo
Signed-off-by: Valentin Rothberg <vrothberg@suse.com> Closes: #1162 Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_top_linux.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/libpod/container_top_linux.go b/libpod/container_top_linux.go
index 450130add..9b0f156b5 100644
--- a/libpod/container_top_linux.go
+++ b/libpod/container_top_linux.go
@@ -6,7 +6,7 @@ import (
"strconv"
"strings"
- "github.com/containers/psgo/ps"
+ "github.com/containers/psgo"
)
// GetContainerPidInformation returns process-related data of all processes in
@@ -19,12 +19,23 @@ import (
// For more details, please refer to github.com/containers/psgo.
func (c *Container) GetContainerPidInformation(descriptors []string) ([]string, error) {
pid := strconv.Itoa(c.state.PID)
- format := strings.Join(descriptors, ",")
- return ps.JoinNamespaceAndProcessInfo(pid, format)
+ // TODO: psgo returns a [][]string to give users the ability to apply
+ // filters on the data. We need to change the API here and the
+ // varlink API to return a [][]string if we want to make use of
+ // filtering.
+ psgoOutput, err := psgo.JoinNamespaceAndProcessInfo(pid, descriptors)
+ if err != nil {
+ return nil, err
+ }
+ res := []string{}
+ for _, out := range psgoOutput {
+ res = append(res, strings.Join(out, "\t"))
+ }
+ return res, nil
}
// GetContainerPidInformationDescriptors returns a string slice of all supported
// format descriptors of GetContainerPidInformation.
func GetContainerPidInformationDescriptors() ([]string, error) {
- return ps.ListDescriptors(), nil
+ return psgo.ListDescriptors(), nil
}