mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Bug #1183780: Add Popen objects to _active only in __del__.
Cleanup terminated processes as well. Add cmd attribute to Popen4.
This commit is contained in:
parent
846d72a7d7
commit
478c82d30f
2 changed files with 23 additions and 7 deletions
|
@ -35,6 +35,9 @@ def _test():
|
|||
# same test as popen2._test(), but using the os.popen*() API
|
||||
print "Testing os module:"
|
||||
import popen2
|
||||
# When the test runs, there shouldn't be any open pipes
|
||||
popen2._cleanup()
|
||||
assert not popen2._active, "Active pipes when test starts " + repr([c.cmd for c in popen2._active])
|
||||
cmd = "cat"
|
||||
teststr = "ab cd\n"
|
||||
if os.name == "nt":
|
||||
|
@ -65,6 +68,7 @@ def _test():
|
|||
raise ValueError("unexpected %r on stderr" % (got,))
|
||||
for inst in popen2._active[:]:
|
||||
inst.wait()
|
||||
popen2._cleanup()
|
||||
if popen2._active:
|
||||
raise ValueError("_active not empty")
|
||||
print "All OK"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue