From: Robin H. Johnson Date: Wed, 27 May 2009 15:47:32 +0000 (-0700) Subject: Normalize spaces and tabs: modules/catalyst/spawn.py - def cleanup X-Git-Tag: CATALYST-2.0.10~3^2~128 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d868afaae50040fc046e3c19f50f8c81c47d1165;p=catalyst.git Normalize spaces and tabs: modules/catalyst/spawn.py - def cleanup --- diff --git a/modules/catalyst/spawn.py b/modules/catalyst/spawn.py index 345270e9..9ab2a230e 100644 --- a/modules/catalyst/spawn.py +++ b/modules/catalyst/spawn.py @@ -27,30 +27,31 @@ except: spawned_pids = [] def cleanup(pids,block_exceptions=True): - """function to go through and reap the list of pids passed to it""" - global spawned_pids - if type(pids) == int: - pids = [pids] - for x in pids: - try: - os.kill(x,signal.SIGTERM) - if os.waitpid(x,os.WNOHANG)[1] == 0: - # feisty bugger, still alive. - os.kill(x,signal.SIGKILL) - os.waitpid(x,0) - - except OSError, oe: - if block_exceptions: - pass - if oe.errno not in (10,3): - raise oe - except SystemExit: - raise - except Exception: - if block_exceptions: - pass - try: spawned_pids.remove(x) - except IndexError: pass + """function to go through and reap the list of pids passed to it""" + global spawned_pids + if type(pids) == int: + pids = [pids] + for x in pids: + try: + os.kill(x,signal.SIGTERM) + if os.waitpid(x,os.WNOHANG)[1] == 0: + # feisty bugger, still alive. + os.kill(x,signal.SIGKILL) + os.waitpid(x,0) + except OSError, oe: + if block_exceptions: + pass + if oe.errno not in (10,3): + raise oe + except SystemExit: + raise + except Exception: + if block_exceptions: + pass + try: + spawned_pids.remove(x) + except IndexError: + pass def spawn_bash(mycommand,env={},debug=False,opt_name=None,**keywords):