mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-29 01:20:13 +00:00
Allow "SIG" prefix on signal names in docker kill ("SIGKILL", etc)
This way, we can use both `docker kill -s INT some_container` and `docker kill -s SIGINT some_container` and both will do nice things for us. :) Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
@@ -144,6 +144,10 @@ func (srv *Server) ContainerKill(job *engine.Job) engine.Status {
|
||||
if err != nil {
|
||||
// The signal is not a number, treat it as a string
|
||||
sig = uint64(signal.SignalMap[job.Args[1]])
|
||||
if sig == 0 && strings.HasPrefix(job.Args[1], "SIG") {
|
||||
// If signal is prefixed with SIG, try with it stripped (ie, "SIGKILL", etc)
|
||||
sig = uint64(signal.SignalMap[job.Args[1][3:]])
|
||||
}
|
||||
if sig == 0 {
|
||||
return job.Errorf("Invalid signal: %s", job.Args[1])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user