From 6abd42c1b62afe471c15e4c493839f86a050ad87 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Thu, 13 Aug 2015 23:42:54 +0800 Subject: [PATCH] Add the default signal (SIGTERM) for runc kill Signed-off-by: Lai Jiangshan --- kill.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kill.go b/kill.go index 6fbbba89..0cf680c7 100644 --- a/kill.go +++ b/kill.go @@ -51,16 +51,23 @@ var signalMap = map[string]syscall.Signal{ var killCommand = cli.Command{ Name: "kill", - Usage: "kill sends the specified signal to the container's init process", + Usage: "kill sends the specified signal (default: SIGTERM) to the container's init process", Action: func(context *cli.Context) { container, err := getContainer(context) if err != nil { fatal(err) } - signal, err := parseSignal(context.Args().First()) + + sigstr := context.Args().First() + if sigstr == "" { + sigstr = "SIGTERM" + } + + signal, err := parseSignal(sigstr) if err != nil { fatal(err) } + if err := container.Signal(signal); err != nil { fatal(err) }