mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:20:54 +00:00
change syscall package to os.Kill
This commit is contained in:
parent
1ea18adce8
commit
ce8a1be8d9
@ -12,7 +12,7 @@ import (
|
||||
"reflect"
|
||||
"strconv"
|
||||
"sync"
|
||||
"syscall"
|
||||
//"syscall"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -82,15 +82,15 @@ func (sl *stoppableListener) Accept() (c net.Conn, err error) {
|
||||
|
||||
func WaitSignal(l net.Listener) error {
|
||||
ch := make(chan os.Signal, 1)
|
||||
signal.Notify(ch, syscall.SIGTERM, syscall.SIGHUP)
|
||||
signal.Notify(ch, os.Interrupt, os.Kill)
|
||||
for {
|
||||
sig := <-ch
|
||||
log.Println(sig.String())
|
||||
switch sig {
|
||||
|
||||
case syscall.SIGTERM:
|
||||
case os.Kill:
|
||||
return nil
|
||||
case syscall.SIGHUP:
|
||||
case os.Interrupt:
|
||||
err := Restart(l)
|
||||
if nil != err {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user