1
0

CLI: poor man's detection of already running daemon.

This commit is contained in:
ThomasV
2023-01-14 09:56:18 +01:00
parent b7106fd746
commit fbf79b148b

View File

@@ -391,6 +391,13 @@ def main():
cmdname = config.get('cmd')
if cmdname == 'daemon' and config.get("detach"):
# detect lockfile.
# This is not as goog as get_file_descriptor, but that would require the asyncio loop
lockfile = daemon.get_lockfile(config)
if os.path.exists(lockfile):
print_stderr("Daemon already running (lockfile detected).")
print_stderr("Run 'electrum stop' to stop the daemon.")
sys.exit(1)
# fork before creating the asyncio event loop
pid = os.fork()
if pid: