mirror of https://github.com/docker/docs.git
Return correct exit code upon signal + SIGQUIT now quits without cleanup
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
This commit is contained in:
parent
9687c087ab
commit
3b3f4bf052
|
@ -54,11 +54,16 @@ func InitServer(job *engine.Job) engine.Status {
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
gosignal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
|
gosignal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
|
||||||
go func() {
|
go func() {
|
||||||
sig := <-c
|
for sig := range c {
|
||||||
log.Printf("Received signal '%v', starting shutdown of docker...\n", sig)
|
log.Printf("Received signal '%v', starting shutdown of docker...\n", sig)
|
||||||
|
switch sig {
|
||||||
|
case os.Interrupt, syscall.SIGTERM:
|
||||||
utils.RemovePidFile(srv.runtime.Config().Pidfile)
|
utils.RemovePidFile(srv.runtime.Config().Pidfile)
|
||||||
srv.Close()
|
srv.Close()
|
||||||
os.Exit(0)
|
case syscall.SIGQUIT:
|
||||||
|
}
|
||||||
|
os.Exit(128 + int(sig.(syscall.Signal)))
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
job.Eng.Hack_SetGlobalVar("httpapi.server", srv)
|
job.Eng.Hack_SetGlobalVar("httpapi.server", srv)
|
||||||
job.Eng.Hack_SetGlobalVar("httpapi.runtime", srv.runtime)
|
job.Eng.Hack_SetGlobalVar("httpapi.runtime", srv.runtime)
|
||||||
|
|
Loading…
Reference in New Issue