diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-19 19:58:29 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-19 19:58:29 -0700 |
commit | 146dea1276fcecb641ee57f080a4d8f2ccce1396 (patch) | |
tree | ee1eef6a2ab73d48cfd34488fe438ee0c94c685b /pym/portage/process.py | |
parent | Optimize ResolverPlayground._create_ebuild_manifests() to use a single (diff) | |
download | portage-146dea1276fcecb641ee57f080a4d8f2ccce1396.tar.gz portage-146dea1276fcecb641ee57f080a4d8f2ccce1396.tar.bz2 portage-146dea1276fcecb641ee57f080a4d8f2ccce1396.zip |
With waitpid and WNOHANG, only check the first element of the tuplev2.2_rc85
since the second element may vary (bug #337465, comment #12).
Diffstat (limited to 'pym/portage/process.py')
-rw-r--r-- | pym/portage/process.py | 10 |
1 files changed, 8 insertions, 2 deletions
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) |