in reply to Re: Preventing multiple instances
in thread Preventing multiple instances

Note that the lock will silently be released if you edit the file while it is running, since flock creates an advisory lock (meaning it can be ignored).

Replies are listed 'Best First'.
Re^3: Preventing multiple instances
by davido (Cardinal) on Nov 23, 2022 at 18:30 UTC

    The lock is coterminous with the open filehandle / file descriptor unless released by LOCK_UN. A write by a process that ignores the lock doesn't release the lock, it just ignores it (which and breakage can occur). A write by the process that holds the lock also would not release the lock.

    At least that's my recollection. The rules can be tricky though. And the fact that locks are advisory is both powerful and scary.


    Dave