From 93135dc705ba6f749dcb4c8eaa965a4c9cc4c456 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 29 Mar 2024 23:29:49 +0100 Subject: [PATCH] lock: drop cleanup handler --- cmd/restic/lock.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cmd/restic/lock.go b/cmd/restic/lock.go index 69d433df1..99e199a67 100644 --- a/cmd/restic/lock.go +++ b/cmd/restic/lock.go @@ -21,18 +21,11 @@ func internalOpenWithLocked(ctx context.Context, gopts GlobalOptions, dryRun boo Verbosef("%s", msg) } }, Warnf) - - unlock = lock.Unlock - // make sure that a repository is unlocked properly and after cancel() was - // called by the cleanup handler in global.go - AddCleanupHandler(func(code int) (int, error) { - lock.Unlock() - return code, nil - }) - if err != nil { return nil, nil, nil, err } + + unlock = lock.Unlock } else { repo.SetDryRun() }