Skip to main content

acquire_worktree_copy_lock

Function acquire_worktree_copy_lock 

Source
pub fn acquire_worktree_copy_lock(
    common_dir: &Path,
    stderr: &mut dyn Write,
) -> Result<WorktreeCopyLease, WorktreeCopyError>
Expand description

What: Acquires the settlement lock: waits for a proven-live owner up to this process’s wait limit, retires a dead one, and gives an owner without evidence the bounded wait before failing. Why: Installation and recovery of one repository must never interleave, and no lock is taken from an owner that might still run.

In TS you’d write (pseudocode):

await using lease = await acquireWorktreeCopyLock(commonDir);