From fe788dddf2a80ba0743f219070ddc1bd54ef70b0 Mon Sep 17 00:00:00 2001 From: guangwu Date: Thu, 18 Apr 2024 16:52:59 +0800 Subject: [PATCH] fix: close tmp file --- utils/log.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/log.go b/utils/log.go index 42a5a8f..57abf64 100644 --- a/utils/log.go +++ b/utils/log.go @@ -27,9 +27,11 @@ func InitLog(options *libs.Options) { } tmpFile, err := os.CreateTemp(logDir, "osmedeus-*.log") if err == nil { + defer tmpFile.Close() options.LogFile = tmpFile.Name() } else { tmpFile, _ := os.CreateTemp("/tmp/", "osmedeus-*.log") + defer tmpFile.Close() options.LogFile = tmpFile.Name() } }