mirror of https://github.com/restic/restic.git
lock: fix missing hint to unlock command if repository is locked
This commit is contained in:
parent
13c32b0fbe
commit
237d00000e
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ retryLoop:
|
||||||
return nil, ctx, errors.Fatalf("%v\n\nthe `unlock --remove-all` command can be used to remove invalid locks. Make sure that no other restic process is accessing the repository when running the command", err)
|
return nil, ctx, errors.Fatalf("%v\n\nthe `unlock --remove-all` command can be used to remove invalid locks. Make sure that no other restic process is accessing the repository when running the command", err)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ctx, errors.Fatalf("unable to create lock in backend: %v", err)
|
return nil, ctx, fmt.Errorf("unable to create lock in backend: %w", err)
|
||||||
}
|
}
|
||||||
debug.Log("create lock %p (exclusive %v)", lock, exclusive)
|
debug.Log("create lock %p (exclusive %v)", lock, exclusive)
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ func TestLockConflict(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("second lock should have failed")
|
t.Fatal("second lock should have failed")
|
||||||
}
|
}
|
||||||
|
test.Assert(t, restic.IsAlreadyLocked(err), "unexpected error %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
type writeOnceBackend struct {
|
type writeOnceBackend struct {
|
||||||
|
|
Loading…
Reference in New Issue