From d868afaae50040fc046e3c19f50f8c81c47d1165 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Wed, 27 May 2009 08:47:32 -0700 Subject: [PATCH] Normalize spaces and tabs: modules/catalyst/spawn.py - def cleanup --- modules/catalyst/spawn.py | 49 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) 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): -- 2.26.2