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(cterm, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
var s os.Signal
|
||||
select {
|
||||
case _ = <-cint:
|
||||
case _ = <-cterm:
|
||||
case s = <-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)
|
||||
|
Loading…
Reference in New Issue
Block a user