mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
Merge pull request #6855 from Luap99/ps-command-trunc
podman ps truncate the command
This commit is contained in:
@ -309,7 +309,13 @@ func (l psReporter) Status() string {
|
|||||||
|
|
||||||
// Command returns the container command in string format
|
// Command returns the container command in string format
|
||||||
func (l psReporter) Command() string {
|
func (l psReporter) Command() string {
|
||||||
return strings.Join(l.ListContainer.Command, " ")
|
command := strings.Join(l.ListContainer.Command, " ")
|
||||||
|
if !noTrunc {
|
||||||
|
if len(command) > 17 {
|
||||||
|
return command[0:17] + "..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return command
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the rootfs and virtual sizes in human duration in
|
// Size returns the rootfs and virtual sizes in human duration in
|
||||||
|
@ -466,4 +466,15 @@ var _ = Describe("Podman ps", func() {
|
|||||||
Expect(ps.ExitCode()).To(Equal(0))
|
Expect(ps.ExitCode()).To(Equal(0))
|
||||||
Expect(ps.OutputToString()).To(ContainSubstring("0.0.0.0:8080->80/tcp"))
|
Expect(ps.OutputToString()).To(ContainSubstring("0.0.0.0:8080->80/tcp"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman ps truncate long create commad", func() {
|
||||||
|
session := podmanTest.Podman([]string{"run", ALPINE, "echo", "very", "long", "create", "command"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"ps", "-a"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.OutputToString()).To(ContainSubstring("echo very long cr..."))
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user