INNER CODE UNIT · Python
uid
Matteo842/SaveState · main.py:106
uid = os.getuid() # type: ignore[attr-defined]
runtime_dir = f"/run/user/{uid}"
except Exception:
runtime_dir = None
if runtime_dir:
server_path = os.path.join(runtime_dir, local_server_name)
if os.path.exists(server_path):
os.unlink(server_path)
logging.warning(f"Unlinked stale local socket: {server_path}")
except Exception as e:
logging.debug(f"Runtime socket unlink failed: {e}")
# Force attach/detach on shared memory to drop a stale segment when no other process holds it
try:
temp_mem = QSharedMemory(shared_memory_key)
if temp_mem.attach():
logging.warning("Attached to stale shared memory; detaching to release it...")
if not temp_mem.detach():