Rename daemon wait
This commit is contained in:
parent
6764bd3005
commit
6b36d76c31
1 changed files with 6 additions and 3 deletions
|
@ -15,16 +15,19 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// WaitForSignal waits until one of the specified signals are received.
|
// WaitForSignal waits until one of the specified signals are received.
|
||||||
func WaitForSignal(sig ...os.Signal) {
|
func WaitForSignal(sig ...os.Signal) os.Signal {
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, sig...)
|
signal.Notify(ch, sig...)
|
||||||
s := <-ch
|
s := <-ch
|
||||||
|
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("signal", s.String()).
|
Str("signal", s.String()).
|
||||||
Msg("Signal caught")
|
Msg("Signal caught")
|
||||||
|
|
||||||
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForDefaultSignals waits until one of SIGINT, SIGQUIT or SIGTERM is received.
|
// WaitForSignalsDefault waits until one of SIGINT, SIGQUIT or SIGTERM is received.
|
||||||
func WaitForDefaultSignals() {
|
func WaitForSignalsDefault() {
|
||||||
WaitForSignal(Interrupt, Quit, Terminate)
|
WaitForSignal(Interrupt, Quit, Terminate)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue