From 146dea1276fcecb641ee57f080a4d8f2ccce1396 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 19 Sep 2010 19:58:29 -0700 Subject: With waitpid and WNOHANG, only check the first element of the tuple since the second element may vary (bug #337465, comment #12). --- pym/portage/process.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pym/portage/process.py') diff --git a/pym/portage/process.py b/pym/portage/process.py index 2787e0884..37b482a0e 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -135,7 +135,10 @@ def cleanup(): while spawned_pids: pid = spawned_pids.pop() try: - if os.waitpid(pid, os.WNOHANG) == (0, 0): + # With waitpid and WNOHANG, only check the + # first element of the tuple since the second + # element may vary (bug #337465). + if os.waitpid(pid, os.WNOHANG)[0] == 0: os.kill(pid, signal.SIGTERM) os.waitpid(pid, 0) except OSError: @@ -289,7 +292,10 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, # If it failed, kill off anything else that # isn't dead yet. for pid in mypids: - if os.waitpid(pid, os.WNOHANG) == (0,0): + # With waitpid and WNOHANG, only check the + # first element of the tuple since the second + # element may vary (bug #337465). + if os.waitpid(pid, os.WNOHANG)[0] == 0: os.kill(pid, signal.SIGTERM) os.waitpid(pid, 0) spawned_pids.remove(pid) -- cgit v1.2.3-1-g7c22