From 17b6f3b64c6af32cd1334f08925c31ad956c7af7 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 19 Sep 2016 12:24:53 -0700 Subject: [PATCH] Convert status to exit code Signed-off-by: Mrunal Patel --- oci/oci.go | 2 +- utils/utils.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/oci/oci.go b/oci/oci.go index 0187e64d..b72b4357 100644 --- a/oci/oci.go +++ b/oci/oci.go @@ -171,7 +171,7 @@ func (r *Runtime) UpdateStatus(c *Container) error { if err != nil { return fmt.Errorf("status code conversion failed: %v", err) } - c.state.ExitCode = int32(statusCode) + c.state.ExitCode = int32(utils.StatusToExitCode(statusCode)) } return nil diff --git a/utils/utils.go b/utils/utils.go index dd90ec28..ca5d7f17 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -125,3 +125,8 @@ func StartReaper() { } }() } + +// StatusToExitCode converts wait status code to an exit code +func StatusToExitCode(status int) int { + return ((status) & 0xff00) >> 8 +}