moved lock

This commit is contained in:
Roy
2026-06-11 18:52:32 -07:00
committed by GitHub
parent b6aaff2959
commit de1ae75c16
+12 -12
View File
@@ -38,19 +38,7 @@ from urllib.parse import (
quote quote
) )
LOCK_FILE = "/tmp/nslgamescanner.lock"
def single_instance():
global lockfile
lockfile = open(LOCK_FILE, "w")
try:
fcntl.flock(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
except BlockingIOError:
print("Another instance is already running. Exiting.")
sys.exit(0)
single_instance()
# Check the value of the DBUS_SESSION_BUS_ADDRESS environment variable # Check the value of the DBUS_SESSION_BUS_ADDRESS environment variable
@@ -228,7 +216,19 @@ else:
LOCK_FILE = "/tmp/nslgamescanner.lock"
def single_instance():
global lockfile
lockfile = open(LOCK_FILE, "w")
try:
fcntl.flock(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
except BlockingIOError:
print("Another instance is already running. Exiting.")
sys.exit(0)
single_instance()
#Code #Code