fix(desktop): distinguish journal lock failures
Desktop core (Gitea) / desktop-core (push) Successful in 1m20s

This commit is contained in:
Pavlo Ratushnyi
2026-10-07 11:20:42 +02:00
parent c62061dd17
commit 2e62a4ea1a
+7 -2
View File
@@ -65,8 +65,13 @@ impl Journal {
options.mode(0o600);
}
let mut file = options.open(path).map_err(|_| "cannot open journal")?;
file.try_lock()
.map_err(|_| "journal already owned or locking unavailable")?;
if let Err(error) = file.try_lock() {
return Err(match error {
std::fs::TryLockError::WouldBlock => "journal already owned",
std::fs::TryLockError::Error(_) => "journal locking unavailable",
}
.into());
}
let meta = file.metadata().map_err(|_| "cannot inspect journal")?;
#[cfg(unix)]
{