Add the default signal (SIGTERM) for runc kill
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
parent
744a6b0e7b
commit
6abd42c1b6
11
kill.go
11
kill.go
|
@ -51,16 +51,23 @@ var signalMap = map[string]syscall.Signal{
|
||||||
|
|
||||||
var killCommand = cli.Command{
|
var killCommand = cli.Command{
|
||||||
Name: "kill",
|
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) {
|
Action: func(context *cli.Context) {
|
||||||
container, err := getContainer(context)
|
container, err := getContainer(context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
signal, err := parseSignal(context.Args().First())
|
|
||||||
|
sigstr := context.Args().First()
|
||||||
|
if sigstr == "" {
|
||||||
|
sigstr = "SIGTERM"
|
||||||
|
}
|
||||||
|
|
||||||
|
signal, err := parseSignal(sigstr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := container.Signal(signal); err != nil {
|
if err := container.Signal(signal); err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue