mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
WebHost: use non-blocking file lock on unix, just like windows
This commit is contained in:
@@ -53,7 +53,7 @@ else: # unix
|
|||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
try:
|
try:
|
||||||
self.fp = open(self.lockfile, "wb")
|
self.fp = open(self.lockfile, "wb")
|
||||||
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)
|
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise AlreadyRunningException() from e
|
raise AlreadyRunningException() from e
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user