diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-11-10 13:43:40 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-11-10 13:43:40 -0500 |
commit | 12ca3ed8838d2e66e7fef019db98a02e6d927be6 (patch) | |
tree | 41d0b3206f6e9f03b548280e04081fe6fc56b4d5 /cherrypy/process/plugins.py | |
parent | 7adb96d8e6f0bb01652d27ed51f9977adf106e94 (diff) | |
download | cherrypy-git-12ca3ed8838d2e66e7fef019db98a02e6d927be6.tar.gz |
Harmonize technique
Diffstat (limited to 'cherrypy/process/plugins.py')
-rw-r--r-- | cherrypy/process/plugins.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/cherrypy/process/plugins.py b/cherrypy/process/plugins.py index c9c18724..24588282 100644 --- a/cherrypy/process/plugins.py +++ b/cherrypy/process/plugins.py @@ -396,11 +396,8 @@ class Daemonizer(SimplePlugin): # Do first fork. try: pid = os.fork() - if pid == 0: - # This is the child process. Continue. - pass - else: - # This is the first parent. Exit, now that we've forked. + if pid > 0: + # This is the parent; exit. logger('Forking once.') os._exit(0) except OSError as exc: @@ -413,8 +410,9 @@ class Daemonizer(SimplePlugin): try: pid = os.fork() if pid > 0: + # This is the parent; exit. logger('Forking twice.') - os._exit(0) # Exit second parent + os._exit(0) except OSError as exc: sys.exit(error_tmpl.format(sys=sys, exc=exc, n=2)) |