From d8ca33145169a98a6f132dfb3581eeaeee54fb96 Mon Sep 17 00:00:00 2001 From: Denis Vaumoron Date: Thu, 23 May 2024 19:06:50 +0200 Subject: [PATCH] proper lock file close #139 (#140) Signed-off-by: Denis Vaumoron --- pkg/lockfile/lockfile.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/lockfile/lockfile.go b/pkg/lockfile/lockfile.go index 0ea225e5..65001672 100644 --- a/pkg/lockfile/lockfile.go +++ b/pkg/lockfile/lockfile.go @@ -39,8 +39,9 @@ const ( func Write(dirPath string, displayer loghelper.Displayer) func() { lockPath := filepath.Join(dirPath, ".lock") for logLevel := hclog.Warn; true; logLevel = hclog.Info { - _, err := os.OpenFile(lockPath, os.O_CREATE|os.O_EXCL, 0644) //nolint + f, err := os.OpenFile(lockPath, os.O_CREATE|os.O_EXCL, 0644) //nolint if err == nil { + f.Close() break }