From bca1e6236893bd222597b70d4781a107ceaad8f4 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Thu, 27 Feb 2025 18:57:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/pkg/github.com/name5566/leaf/leaf.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/server/pkg/github.com/name5566/leaf/leaf.go b/src/server/pkg/github.com/name5566/leaf/leaf.go index 5bb4665e..afc93c41 100644 --- a/src/server/pkg/github.com/name5566/leaf/leaf.go +++ b/src/server/pkg/github.com/name5566/leaf/leaf.go @@ -41,7 +41,17 @@ func Run(mods ...module.Module) { // console 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 c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)