Explorar el Código

Close PID file

Unrud hace 10 años
padre
commit
0a09804821
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      radicale/__main__.py

+ 2 - 1
radicale/__main__.py

@@ -105,7 +105,8 @@ def run():
         if pid:
         if pid:
             sys.exit()
             sys.exit()
         elif config.get("server", "pid"):
         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")
         sys.stdout = sys.stderr = open(os.devnull, "w")
 
 
     # Register exit function
     # Register exit function