Explorar o código

Decouple the daemon from its parent environment

Unrud %!s(int64=10) %!d(string=hai) anos
pai
achega
ecb8ad747e
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      radicale/__main__.py

+ 4 - 0
radicale/__main__.py

@@ -114,6 +114,10 @@ def run():
         if config.get("server", "pid"):
             with os.fdopen(pid_fd, "w") as pid_file:
                 pid_file.write(str(os.getpid()))
+        # Decouple environment
+        os.umask(0)
+        os.chdir("/")
+        os.setsid()
         sys.stdout = sys.stderr = open(os.devnull, "w")
 
     # Register exit function