1
0

CLI/RPC: better error msg when running daemon on Windows

`-d` is not supported, due to missing os.fork

related: https://github.com/spesmilo/electrum/issues/5511
This commit is contained in:
SomberNight
2023-05-16 12:28:59 +00:00
parent a7d3240bc2
commit 68eaa680f8

View File

@@ -419,7 +419,13 @@ def main():
print_stderr("Run 'electrum stop' to stop the daemon.")
sys.exit(1)
# fork before creating the asyncio event loop
pid = os.fork()
try:
pid = os.fork()
except AttributeError as e:
print_stderr(f"Error: {e!r}")
print_stderr("Running daemon in detached mode (-d) is not supported on this platform.")
print_stderr("Try running the daemon in the foreground (without -d).")
sys.exit(1)
if pid:
print_stderr("starting daemon (PID %d)" % pid)
sys.exit(0)