From ad1c9b99aee06d70b8f062147e7984ec29d86ce5 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 14 Jan 2021 16:20:51 +0000 Subject: [PATCH] Suggest retry if lockfile disappears --- lockfile.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lockfile.go b/lockfile.go index 76bdfbe..d50451b 100644 --- a/lockfile.go +++ b/lockfile.go @@ -139,6 +139,10 @@ func (l Lockfile) TryLock() error { proc, err := l.GetOwner() switch err { default: + if os.IsNotExist(err) { + // tell user that a retry would be a good idea + return ErrNotExist + } // Other errors -> defensively fail and let caller handle this return err case nil: