aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-03-08 13:04:44 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-09 01:45:51 +0000
commit984dfecb2c1293062edf4cbb77a2b4e115c81fd5 (patch)
tree2337730ff94669b2dac54b1292d89b7fdb17868c
parent713c08630beff2c3ce4eabeab6dbf5b6dd6fff45 (diff)
downloadpodman-984dfecb2c1293062edf4cbb77a2b4e115c81fd5.tar.gz
podman-984dfecb2c1293062edf4cbb77a2b4e115c81fd5.tar.bz2
podman-984dfecb2c1293062edf4cbb77a2b4e115c81fd5.zip
podman ps command string too long
The default outout for podman ps should limit itself if the command is long. If the command is more than 20 characters, we truncate the command and add an elipses to it. Resolves: #464 Signed-off-by: baude <bbaude@redhat.com> Closes: #466 Approved by: rhatdan
-rw-r--r--cmd/podman/ps.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index 14da06ae8..26991af4b 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -435,6 +435,11 @@ func getTemplateOutput(containers []*libpod.Container, opts psOptions) ([]psTemp
}
command := strings.Join(batchInfo.conConfig.Spec.Process.Args, " ")
+ if !opts.noTrunc {
+ if len(command) > 20 {
+ command = command[:19] + "..."
+ }
+ }
ports := portsToString(batchInfo.conConfig.PortMappings)
mounts := getMounts(createArtifact.Volumes, opts.noTrunc)
labels := formatLabels(ctr.Labels())
@@ -471,6 +476,7 @@ func getTemplateOutput(containers []*libpod.Container, opts psOptions) ([]psTemp
Mounts: mounts,
PID: batchInfo.pid,
}
+
if opts.namespace {
params.Cgroup = ns.Cgroup
params.IPC = ns.IPC