cmd/restic: Add locks to commands

This commit is contained in:
Alexander Neumann
2015-06-27 14:40:18 +02:00
parent 7d2699b429
commit 65a0def949
10 changed files with 62 additions and 0 deletions

View File

@@ -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)