Calling _cleanup() does not guarantee that all processes have
terminated; this makes the final assert in the self-test code fail if
the parent runs faster than the children. Fix this by calling wait()
on the remaining children instead.
diff --git a/Lib/popen2.py b/Lib/popen2.py
index 4c42958..d4b5d26 100644
--- a/Lib/popen2.py
+++ b/Lib/popen2.py
@@ -91,7 +91,8 @@
w.close()
assert r.read() == teststr
assert e.read() == ""
- _cleanup()
+ for inst in _active[:]:
+ inst.wait()
assert not _active
print "All OK"