[pypy-svn] r74783 - pypy/trunk/pypy/module/posix/test

arigo at codespeak.net arigo at codespeak.net
Wed May 26 18:12:21 CEST 2010


Author: arigo
Date: Wed May 26 18:12:19 2010
New Revision: 74783

Modified:
   pypy/trunk/pypy/module/posix/test/test_posix2.py
Log:
First clean up the zombie processes left behind by some other reason.
This is needed because otherwise the following os.wait() might return
one of them instead of the expected one.


Modified: pypy/trunk/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/trunk/pypy/module/posix/test/test_posix2.py	(original)
+++ pypy/trunk/pypy/module/posix/test/test_posix2.py	Wed May 26 18:12:19 2010
@@ -490,6 +490,12 @@
 
             if not hasattr(os, "fork"):
                 skip("Need fork() to test wait()")
+            if hasattr(os, "waitpid") and hasattr(os, "WNOHANG"):
+                try:
+                    while os.waitpid(-1, os.WNOHANG)[0]:
+                        pass
+                except OSError:  # until we get "No child processes", hopefully
+                    pass
             child = os.fork()
             if child == 0: # in child
                 os._exit(exit_status)



More information about the Pypy-commit mailing list