1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/client/container/utils.go
Zhang Wei c111b7eb3d Move GetExitCode to package container and unexport it
GetExitCode is used only by container package, so move it to package
container and unexport it

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-09 18:04:53 +08:00

22 lines
647 B
Go

package container
import (
"golang.org/x/net/context"
"github.com/docker/docker/api/client"
clientapi "github.com/docker/engine-api/client"
)
// getExitCode perform an inspect on the container. It returns
// the running state and the exit code.
func getExitCode(dockerCli *client.DockerCli, ctx context.Context, containerID string) (bool, int, error) {
c, err := dockerCli.Client().ContainerInspect(ctx, containerID)
if err != nil {
// If we can't connect, then the daemon probably died.
if err != clientapi.ErrConnectionFailed {
return false, -1, err
}
return false, -1, nil
}
return c.State.Running, c.State.ExitCode, nil
}