Merge pull request #210 from maggot611/deamon_exit

[bug fix]weed daemon exit due to hangup signal when terminal close
This commit is contained in:
chrislusf 2015-10-19 01:01:24 -07:00
commit 2395ee9b2e

View file

@ -11,11 +11,13 @@ import (
func OnInterrupt(fn func()) {
// deal with control+c,etc
signalChan := make(chan os.Signal, 1)
// controlling terminal close, daemon not exit
signal.Ignore(syscall.SIGHUP)
signal.Notify(signalChan,
os.Interrupt,
os.Kill,
syscall.SIGALRM,
syscall.SIGHUP,
// syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGQUIT)