]> kaliko git repositories - python-daemon.git/commitdiff
Write pid before resetting umask
authorkaliko <efrim@azylum.org>
Sun, 22 May 2011 18:07:14 +0000 (20:07 +0200)
committerkaliko <efrim@azylum.org>
Sun, 22 May 2011 18:07:14 +0000 (20:07 +0200)
src/daemon.py

index 787cb65681ae720fbfe48e0d5e8da86239d52c19..7489233bddbb8e84a297cde3b5288cffc480f983 100644 (file)
@@ -59,7 +59,6 @@ class Daemon(object):
             sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror))
             sys.exit(1)
 
-        self.write_pid()
         # redirect standard file descriptors
         sys.stdout.flush()
         sys.stderr.flush()
@@ -114,6 +113,7 @@ class Daemon(object):
             sys.stderr.write(message % self.pidfile)
             sys.exit(1)
 
+        self.write_pid()
         # Start the daemon
         self.daemonize()
         self.run()