Add the default signal (SIGTERM) for runc kill

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan 2015-08-13 23:42:54 +08:00
parent 744a6b0e7b
commit 6abd42c1b6
1 changed files with 9 additions and 2 deletions

11
kill.go
View File

@ -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)
}