Merge pull request #1902 from ludovic111/fix/supervisor-lock-test-race

🤖 Agent: merged after verify passed (test-only fix).
This commit is contained in:
Ludovic Marie
2026-10-25 20:23:30 +01:00
committed by GitHub
+11 -1
View File
@@ -849,7 +849,17 @@ mod tests {
let first = lock(&dir).unwrap();
assert!(lock(&dir).unwrap_err().contains("already running"));
drop(first);
lock(&dir).unwrap();
// A process another test spawns holds a copy of the lock's descriptor between its fork and exec:
// the lock comes back once that child has exec'd.
let mut again = lock(&dir);
for _ in 0..50 {
if again.is_ok() {
break;
}
std::thread::sleep(std::time::Duration::from_millis(20));
again = lock(&dir);
}
again.unwrap();
std::fs::remove_dir_all(&dir).unwrap();
}
}