summaryrefslogtreecommitdiff
path: root/cmd/podman/batchcontainer/container.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-07-13 11:21:37 -0400
committerMatthew Heon <mheon@redhat.com>2018-07-13 14:28:41 -0400
commit4c44185199299f44425ebd689bf3ac42e4606788 (patch)
treeb11dd559505e2bcedc266e0ad7ae5d75b32f3334 /cmd/podman/batchcontainer/container.go
parentd25ebcc35bc59ac536eacf59af978181e6adabd3 (diff)
downloadpodman-4c44185199299f44425ebd689bf3ac42e4606788.tar.gz
podman-4c44185199299f44425ebd689bf3ac42e4606788.tar.bz2
podman-4c44185199299f44425ebd689bf3ac42e4606788.zip
Major fixes to podman ps --format=json output
A number of fields were never being populated. Populate them as best we can. Add a new field, exited, to indicate whether the exit code has meaning (IE, the container has exited). Fix handling of running time - it stops ticking when the container stops. There is further work needed here, I suspect. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'cmd/podman/batchcontainer/container.go')
-rw-r--r--cmd/podman/batchcontainer/container.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/podman/batchcontainer/container.go b/cmd/podman/batchcontainer/container.go
index 76b10b633..6f002f58a 100644
--- a/cmd/podman/batchcontainer/container.go
+++ b/cmd/podman/batchcontainer/container.go
@@ -38,6 +38,7 @@ type BatchContainerStruct struct {
ConConfig *libpod.ContainerConfig
ConState libpod.ContainerStatus
ExitCode int32
+ Exited bool
Pid int
RootFsSize, RwSize int64
StartedTime time.Time
@@ -63,6 +64,7 @@ func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStru
conState libpod.ContainerStatus
err error
exitCode int32
+ exited bool
pid int
rootFsSize, rwSize int64
startedTime time.Time
@@ -75,7 +77,7 @@ func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStru
return errors.Wrapf(err, "unable to obtain container state")
}
- exitCode, _, err = c.ExitCode()
+ exitCode, exited, err = c.ExitCode()
if err != nil {
return errors.Wrapf(err, "unable to obtain container exit code")
}
@@ -115,6 +117,7 @@ func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStru
ConConfig: conConfig,
ConState: conState,
ExitCode: exitCode,
+ Exited: exited,
Pid: pid,
RootFsSize: rootFsSize,
RwSize: rwSize,