forked from mirrors/jj
lock: treat PermissionDenied on Windows as transient error
On Windows it can be PermissionDenied when creating the new file exclusively. This change makes lock_concurrent test pass on Windows.
This commit is contained in:
parent
2f93ebd42c
commit
935da3e13f
1 changed files with 3 additions and 0 deletions
|
@ -36,6 +36,9 @@ impl FileLock {
|
||||||
Err(err) if err.kind() == std::io::ErrorKind::AlreadyExists => {
|
Err(err) if err.kind() == std::io::ErrorKind::AlreadyExists => {
|
||||||
Err(backoff::Error::Transient(err))
|
Err(backoff::Error::Transient(err))
|
||||||
}
|
}
|
||||||
|
Err(err) if cfg!(windows) && err.kind() == std::io::ErrorKind::PermissionDenied => {
|
||||||
|
Err(backoff::Error::Transient(err))
|
||||||
|
}
|
||||||
Err(err) => Err(backoff::Error::Permanent(err)),
|
Err(err) => Err(backoff::Error::Permanent(err)),
|
||||||
};
|
};
|
||||||
let mut backoff = ExponentialBackoff {
|
let mut backoff = ExponentialBackoff {
|
||||||
|
|
Loading…
Reference in a new issue