From 0a09804821fd7d77d089c47c57ff277bff60b891 Mon Sep 17 00:00:00 2001 From: Unrud Date: Tue, 22 Dec 2015 06:49:33 +0100 Subject: [PATCH] Close PID file --- radicale/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radicale/__main__.py b/radicale/__main__.py index bd09647..b2f39db 100644 --- a/radicale/__main__.py +++ b/radicale/__main__.py @@ -105,7 +105,8 @@ def run(): if pid: sys.exit() elif config.get("server", "pid"): - open(config.get("server", "pid"), "w").write(str(os.getpid())) + with open(config.get("server", "pid"), "w") as pid_file: + pid_file.write(str(os.getpid())) sys.stdout = sys.stderr = open(os.devnull, "w") # Register exit function