libs/os: remove trap signal (#7515)

This commit is contained in:
Sam Kleinman
2022-01-06 08:26:37 -05:00
committed by GitHub
parent 386c3a0ff7
commit 0ae974e639
6 changed files with 24 additions and 116 deletions
+9 -9
View File
@@ -83,19 +83,19 @@ func cmdKVStore(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
// Stop upon receiving SIGTERM or CTRL-C.
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer cancel()
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
if err := srv.Start(ctx); err != nil {
return err
}
// Stop upon receiving SIGTERM or CTRL-C.
tmos.TrapSignal(logger, func() {
// Cleanup
srv.Stop()
})
// Run forever.
select {}
// Run until shutdown.
<-ctx.Done()
srv.Wait()
}
```