mirror of
https://github.com/restic/restic.git
synced 2025-12-12 03:11:56 +00:00
cmd/restic: Add locks to commands
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/repository"
|
||||
)
|
||||
@@ -121,6 +122,12 @@ func (cmd CmdKey) Execute(args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
lock, err := restic.NewExclusiveLock(repo)
|
||||
defer lock.Unlock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch args[0] {
|
||||
case "list":
|
||||
return cmd.listKeys(repo)
|
||||
|
||||
Reference in New Issue
Block a user