Skip to content

Commit

Permalink
filelock: fix lockfile cleanup
Browse files Browse the repository at this point in the history
Python 3.7 does not support the "missing_ok" argument
in pathlib.unlink().

Signed-off-by:  Eric Callahan <[email protected]>
  • Loading branch information
Arksine committed May 21, 2024
1 parent e41a934 commit bc34ebd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion moonraker/utils/filelock.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ async def acquire(self) -> None:

def _release_file(self) -> None:
with contextlib.suppress(OSError, PermissionError):
self.lock_path.unlink(missing_ok=True)
if self.lock_path.is_file():
self.lock_path.unlink()
with contextlib.suppress(OSError, PermissionError):
fcntl.flock(self.fd, fcntl.LOCK_UN)
with contextlib.suppress(OSError, PermissionError):
Expand Down

0 comments on commit bc34ebd

Please sign in to comment.