From 464311251197c04e0273e0d2bb11ca86f2ee47bc Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Thu, 24 Jul 2014 17:49:56 +0200 Subject: [PATCH] deplace pid file creation in child process --- radicale/__main__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/radicale/__main__.py b/radicale/__main__.py index e89b9da..7b3cc20 100644 --- a/radicale/__main__.py +++ b/radicale/__main__.py @@ -103,11 +103,10 @@ def run(): raise OSError("PID file exists: %s" % config.get("server", "pid")) pid = os.fork() if pid: - try: - if config.get("server", "pid"): - open(config.get("server", "pid"), "w").write(str(pid)) - finally: - sys.exit() + sys.exit() + else: + if config.get("server", "pid"): + open(config.get("server", "pid"), "w").write(str(pid)) sys.stdout = sys.stderr = open(os.devnull, "w") # Register exit function