Fix signal handling for termination, proper engine cleanup
This commit is contained in:
parent
1e495763f5
commit
99d03e3bc9
@ -141,11 +141,14 @@ func main() {
|
|||||||
signal.Notify(cint, os.Interrupt, syscall.SIGINT)
|
signal.Notify(cint, os.Interrupt, syscall.SIGINT)
|
||||||
signal.Notify(cterm, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(cterm, os.Interrupt, syscall.SIGTERM)
|
||||||
go func() {
|
go func() {
|
||||||
|
var s os.Signal
|
||||||
select {
|
select {
|
||||||
case _ = <-cint:
|
case s = <-cterm:
|
||||||
case _ = <-cterm:
|
case s = <-cint:
|
||||||
}
|
}
|
||||||
menuStorageService.Close(ctx)
|
logg.InfoCtxf(ctx, "stopping on signal", "sig", s)
|
||||||
|
en.Finish(ctx)
|
||||||
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = engine.Loop(ctx, en, os.Stdin, os.Stdout, nil)
|
err = engine.Loop(ctx, en, os.Stdin, os.Stdout, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user