True if a `try_lock*` error means the file lock is currently held by another process, rather than a genuine I/O failure. On Unix a contended non-blocking lock surfaces as `WouldBlock`, but on Windows the OS returns `ERROR_LOCK_VIOLATION` (code 33), which maps to `ErrorKind::Uncategorized` rather than `WouldBlock`. Comparing the raw OS error against `fs2::lock_contended_error()` handles both platf
(e: &std::io::Error)
| 78 | /// `ErrorKind::Uncategorized` rather than `WouldBlock`. Comparing the raw OS |
| 79 | /// error against `fs2::lock_contended_error()` handles both platforms. |
| 80 | pub(crate) fn is_lock_contended(e: &std::io::Error) -> bool { |
| 81 | e.kind() == std::io::ErrorKind::WouldBlock |
| 82 | || (e.raw_os_error().is_some() |
| 83 | && e.raw_os_error() == fs2::lock_contended_error().raw_os_error()) |
| 84 | } |
| 85 | |
| 86 | use std::path::{Path, PathBuf}; |
| 87 | use std::sync::Arc; |
no test coverage detected