From ca2965c97976f4bec622bc5752168dde1bae4199 Mon Sep 17 00:00:00 2001 From: keac Date: Sat, 18 May 2024 21:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enscan.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/enscan.go b/enscan.go index 7eeaf18..1ed9f3e 100644 --- a/enscan.go +++ b/enscan.go @@ -20,12 +20,14 @@ func main() { gologger.Error().Msgf("任务未完成退出,自动保存过程文件!") enDataList := make(map[string][]map[string]string) close(runner.EnCh) - for ch := range runner.EnCh { - utils.MergeMap(ch, enDataList) - } - err := common.OutFileByEnInfo(enDataList, "意外退出保存文件", "xlsx", "outs") - if err != nil { - gologger.Error().Msgf(err.Error()) + if len(runner.EnCh) > 0 { + for ch := range runner.EnCh { + utils.MergeMap(ch, enDataList) + } + err := common.OutFileByEnInfo(enDataList, "意外退出保存文件", "xlsx", "outs") + if err != nil { + gologger.Error().Msgf(err.Error()) + } } log.Fatal("exit.by.signal") }