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:
parent
1ea18adce8
commit
ce8a1be8d9
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user