Skip to main content

acquire

Function acquire 

Source
pub fn acquire(lock_name: &str) -> Result<InstanceGuard, InstanceError>
Expand description

Acquire the single-instance lock on lock_name (a bare file name resolved under paths::config_dir). Returns Ok(guard) on success — keep the guard alive until the process is about to exit.

AlreadyRunning is the polite “another copy is open” signal callers surface to the user (and exit with a non-error status). Other variants indicate filesystem trouble.

§Errors

Returns InstanceError if the lock path can’t be resolved, the lock file can’t be opened, another instance already holds the lock, or the lock syscall itself fails.