From 6cb1c31d3f9e575688ace95206898c7fff0c88f9 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 26 Feb 2018 09:08:19 -0600 Subject: Restrict top output to container's pids only Due to the way ps arguments work, it was possible to display pids that dont below to the container in top output. We now filter pids that dont belong to the container out of the output. This also means the pid column must be present in the output or we throw an error. This resolves issue #391 Signed-off-by: baude Closes: #400 Approved by: rhatdan --- cmd/podman/top.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/podman/top.go b/cmd/podman/top.go index 6aff25a71..5ff3b6643 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -70,11 +70,11 @@ func topCmd(c *cli.Context) error { psArgs = append(psArgs, psOpts...) - results, err := container.GetContainerPidInformation(psArgs) + psOutput, err := container.GetContainerPidInformation(psArgs) if err != nil { return err } - for _, line := range results { + for _, line := range psOutput { fmt.Println(line) } return nil -- cgit v1.2.3-54-g00ecf