1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 17:30:56 +00:00

change syscall package to os.Kill

This commit is contained in:
astaxie 2013-12-07 16:52:39 +08:00
parent 1ea18adce8
commit ce8a1be8d9

View File

@ -12,7 +12,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"sync" "sync"
"syscall" //"syscall"
) )
const ( const (
@ -82,15 +82,15 @@ func (sl *stoppableListener) Accept() (c net.Conn, err error) {
func WaitSignal(l net.Listener) error { func WaitSignal(l net.Listener) error {
ch := make(chan os.Signal, 1) ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGTERM, syscall.SIGHUP) signal.Notify(ch, os.Interrupt, os.Kill)
for { for {
sig := <-ch sig := <-ch
log.Println(sig.String()) log.Println(sig.String())
switch sig { switch sig {
case syscall.SIGTERM: case os.Kill:
return nil return nil
case syscall.SIGHUP: case os.Interrupt:
err := Restart(l) err := Restart(l)
if nil != err { if nil != err {
return err return err