Commit 095bfb83 authored by Jim Fulton's avatar Jim Fulton

Merged 1.5.140.1 and 1.5.140.2.

parent d4896797
......@@ -176,18 +176,19 @@ def forkit(attempts = FORK_ATTEMPTS):
def run(argv, pidfile=''):
if os.environ.has_key('ZDAEMON_MANAGED'):
# We're the child at this point. Don't ask. :/
return
os.environ['ZDAEMON_MANAGED']='TRUE'
if not os.environ.has_key('Z_DEBUG_MODE'):
# Detach from terminal
pid = os.fork()
if pid:
sys.exit(0)
posix.setsid()
while 1:
if not os.environ.has_key('Z_DEBUG_MODE'):
pid = os.fork()
if pid:
sys.exit(0)
posix.setsid()
lastt=time.time()
try:
pid = forkit()
......@@ -215,12 +216,10 @@ def run(argv, pidfile=''):
if s:
pstamp(('Aiieee! %s exited with error code: %s'
% (p, s)), zLOG.ERROR)
if time.time()-lastt < 20:
raise ForkError # We're probably hosed
else:
raise ForkError
pstamp(('The kid, %s, died on me.' % pid),
zLOG.WARNING)
raise ForkError
raise KidDiedOnMeError
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment