mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-23 00:34:21 +01:00
handle clean shutdown
This commit is contained in:
@@ -2,11 +2,20 @@ package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/breez/lspd/cln_plugin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
plugin := cln_plugin.NewClnPlugin(os.Stdin, os.Stdout)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
// Stop everything gracefully on stop signal
|
||||
plugin.Stop()
|
||||
}()
|
||||
plugin.Start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user