ok/jj
1
0
Fork 0
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:
Jun Wu 2021-03-10 22:59:52 -08:00
parent 2f93ebd42c
commit 935da3e13f

View file

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