Add num check for kill command

Signed-off-by: Shukui Yang <yangshukui@huawei.com>
This commit is contained in:
Shukui Yang 2016-10-11 14:15:04 +08:00
parent 26ebd6ab63
commit a367e4b95c
1 changed files with 7 additions and 2 deletions

View File

@ -77,7 +77,6 @@ signal to the init process of the "ubuntu01" container:
if err != nil {
return err
}
if err := container.Signal(signal); err != nil {
return err
}
@ -88,7 +87,13 @@ signal to the init process of the "ubuntu01" container:
func parseSignal(rawSignal string) (syscall.Signal, error) {
s, err := strconv.Atoi(rawSignal)
if err == nil {
return syscall.Signal(s), nil
sig := syscall.Signal(s)
for _, msig := range signalMap {
if sig == msig {
return sig, nil
}
}
return -1, fmt.Errorf("unknown signal %q", rawSignal)
}
signal, ok := signalMap[strings.TrimPrefix(strings.ToUpper(rawSignal), "SIG")]
if !ok {