Skip to content

Commit a41e686

Browse files
author
Benedikt Schmitt
committed
*undo* cb1d83d (clean up the lockfile under unix) (issue #31)
1 parent f9a00a8 commit a41e686

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

filelock.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,14 @@ def _acquire(self):
391391
return None
392392

393393
def _release(self):
394+
# Do not remove the lockfile:
395+
#
396+
# https://github.com/benediktschmitt/py-filelock/issues/31
397+
# https://stackoverflow.com/questions/17708885/flock-removing-locked-file-without-race-condition
394398
fd = self._lock_file_fd
395399
self._lock_file_fd = None
396400
fcntl.flock(fd, fcntl.LOCK_UN)
397401
os.close(fd)
398-
399-
try:
400-
os.remove(self._lock_file)
401-
except OSError:
402-
pass
403402
return None
404403

405404
# Soft lock

0 commit comments

Comments
 (0)