[lxc-devel] [go-lxc/v2] fix incorrect status code from runCommandStatus

s3rj1k on Github lxc-bot at linuxcontainers.org
Thu May 24 17:22:01 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 477 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180524/1c9e7f2d/attachment.bin>
-------------- next part --------------
From c968017125e4f7dc1bcb439ee0b8bdeb088c175c Mon Sep 17 00:00:00 2001
From: s3rj1k <evasive.gyron at gmail.com>
Date: Thu, 24 May 2018 20:20:22 +0300
Subject: [PATCH] fix incorrect status code from runCommandStatus

runCommandStatus should return correct status codes (use of WEXITSTATUS macro)
as lxc-execute does in https://github.com/lxc/lxc/blob/master/src/lxc/tools/lxc_execute.c#L239
---
 container.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/container.go b/container.go
index 79bfd2e..daac409 100644
--- a/container.go
+++ b/container.go
@@ -1282,7 +1282,7 @@ func (c *Container) runCommandStatus(args []string, options AttachOptions) (int,
 		cargs,
 	))
 
-	return ret, nil
+	return int(uint8(ret >> 8)), nil
 }
 
 // RunCommandStatus attachs a shell and runs the command within the container.


More information about the lxc-devel mailing list