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)
| 75 | /// `ErrorKind::Uncategorized` rather than `WouldBlock`. Comparing the raw OS |
| 76 | /// error against `fs2::lock_contended_error()` handles both platforms. |
| 77 | pub(crate) fn is_lock_contended(e: &std::io::Error) -> bool { |
| 78 | e.kind() == std::io::ErrorKind::WouldBlock |
| 79 | || (e.raw_os_error().is_some() |
| 80 | && e.raw_os_error() == fs2::lock_contended_error().raw_os_error()) |
| 81 | } |
| 82 | |
| 83 | use std::path::{Path, PathBuf}; |
| 84 |
no test coverage detected