We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 32aa0b2 + 8ff0681 commit 231b03cCopy full SHA for 231b03c
1 file changed
Monika After Story/game/python-packages/singleton.py
@@ -36,7 +36,14 @@ def __init__(self, flavor_id=""):
36
# file already exists, we try to remove (in case previous
37
# execution was interrupted)
38
if os.path.exists(self.lockfile):
39
- os.unlink(self.lockfile)
+ try:
40
+ os.unlink(self.lockfile)
41
+ except OSError:
42
+ # Race conditions happen, make sure the file is actually deleted
43
+ # Carry on with the startup if it is
44
+ if os.path.exists(self.lockfile):
45
+ raise
46
+
47
self.fd = os.open(self.lockfile, os.O_CREAT | os.O_EXCL | os.O_RDWR)
48
49
except OSError as e:
0 commit comments