From b111fc364611d755ac791c5c51c82c5754fe545b Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Fri, 31 Jan 2014 01:42:28 +0800 Subject: [PATCH] Use lxc-stop -k when lxc-kill is not found lxc-kill was removed in lxc/lxc@33ddfc2 Docker-DCO-1.1-Signed-off-by: Chia-liang Kao (github: clkao) --- execdriver/lxc/driver.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/execdriver/lxc/driver.go b/execdriver/lxc/driver.go index 4e8f586f82..054f16a649 100644 --- a/execdriver/lxc/driver.go +++ b/execdriver/lxc/driver.go @@ -212,7 +212,16 @@ func (d *driver) version() string { } func (d *driver) kill(c *execdriver.Command, sig int) error { - output, err := exec.Command("lxc-kill", "-n", c.ID, strconv.Itoa(sig)).CombinedOutput() + var ( + err error + output []byte + ) + _, err = exec.LookPath("lxc-kill") + if err == nil { + output, err = exec.Command("lxc-kill", "-n", c.ID, strconv.Itoa(sig)).CombinedOutput() + } else { + output, err = exec.Command("lxc-stop", "-k", "-n", c.ID, strconv.Itoa(sig)).CombinedOutput() + } if err != nil { return fmt.Errorf("Err: %s Output: %s", err, output) }