diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index c483376681..09f73ffd22 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -351,8 +351,8 @@ func (l psReporter) Pod() string { return l.ListContainer.Pod } -// State returns the container state in human duration -func (l psReporter) State() string { +// Status returns the container status in the default ps output format. +func (l psReporter) Status() string { var state string switch l.ListContainer.State { case "running": @@ -370,16 +370,11 @@ func (l psReporter) State() string { //nolint:staticcheck state = strings.Title(l.ListContainer.State) } - return state -} - -// Status is a synonym for State() -func (l psReporter) Status() string { hc := l.ListContainer.Status if hc != "" { - return l.State() + " (" + hc + ")" + state += " (" + hc + ")" } - return l.State() + return state } func (l psReporter) RunningFor() string { diff --git a/test/system/040-ps.bats b/test/system/040-ps.bats index f450caf7cb..08bcd39f30 100644 --- a/test/system/040-ps.bats +++ b/test/system/040-ps.bats @@ -14,8 +14,8 @@ load helpers # Special case: formatted ps run_podman ps --no-trunc \ - --format '{{.ID}} {{.Image}} {{.Command}} {{.Names}}' - is "$output" "$cid $IMAGE sleep 5 $rand_name" "podman ps" + --format '{{.ID}} {{.Image}} {{.Command}} {{.Names}} {{.State}}' + is "$output" "$cid $IMAGE sleep 5 $rand_name running" "podman ps" # Plain old regular ps