1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #2957 from creack/handle_sigquit

Catch SIGQUIT for cleanup
This commit is contained in:
Victor Vieux 2013-12-02 12:13:07 -08:00
commit 67c03552f6

View file

@ -38,7 +38,7 @@ func init() {
// jobInitApi runs the remote api server `srv` as a daemon, // jobInitApi runs the remote api server `srv` as a daemon,
// Only one api server can run at the same time - this is enforced by a pidfile. // Only one api server can run at the same time - this is enforced by a pidfile.
// The signals SIGINT and SIGTERM are intercepted for cleanup. // The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
func jobInitApi(job *engine.Job) engine.Status { func jobInitApi(job *engine.Job) engine.Status {
job.Logf("Creating server") job.Logf("Creating server")
// FIXME: ImportEnv deprecates ConfigFromJob // FIXME: ImportEnv deprecates ConfigFromJob
@ -56,7 +56,7 @@ func jobInitApi(job *engine.Job) engine.Status {
} }
job.Logf("Setting up signal traps") job.Logf("Setting up signal traps")
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Signal(syscall.SIGTERM)) signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
go func() { go func() {
sig := <-c sig := <-c
log.Printf("Received signal '%v', exiting\n", sig) log.Printf("Received signal '%v', exiting\n", sig)