The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/go-lxc/pull/75
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Add method `StartWithArgs` to support starting container with args. Signed-off-by: sungengze
From 997a4f9ace443e50890b1694aea5e449a353283c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BA=9A=E6=B3=BD?= <690388...@qq.com> Date: Wed, 15 Feb 2017 21:50:14 +0800 Subject: [PATCH] Add method to support starting container with args Add method `StartWithArgs` to support starting container with args. Signed-off-by: sungengze --- container.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/container.go b/container.go index ae09abc..4d63144 100644 --- a/container.go +++ b/container.go @@ -452,6 +452,20 @@ func (c *Container) Start() error { return nil } +func (c *Container) StartWithArgs(args []string) error { + if err := c.makeSure(isNotRunning); err != nil { + return err + } + + c.mu.Lock() + defer c.mu.Unlock() + + if !bool(C.go_lxc_start(c.container, 0, makeNullTerminatedArgs(args))) { + return ErrStartFailed + } + return nil +} + // Execute executes the given command in a temporary container. func (c *Container) Execute(args ...string) ([]byte, error) { if err := c.makeSure(isNotDefined); err != nil {
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel