This commit is contained in:
hahwu 2025-02-27 18:57:24 +08:00
parent a7305f66dc
commit bca1e62368

View File

@ -41,7 +41,17 @@ func Run(mods ...module.Module) {
// console // console
console.Init() console.Init()
defer func() {
if r := recover(); r != nil {
log.Debug("Leaf console error: %v", r)
log.Debug("Leaf closing down\n")
console.Destroy()
cluster.Destroy()
module.Destroy()
game.Destroy()
os.Exit(1)
}
}()
// close // close
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM, syscall.SIGINT) signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)