]> granicus.if.org Git - python/commitdiff
Preserve command name, for later printing of active
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 23 Mar 2006 18:18:35 +0000 (18:18 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 23 Mar 2006 18:18:35 +0000 (18:18 +0000)
commands. If there are active commands when the tests
start, fail, printing these commands.

Lib/popen2.py
Misc/NEWS

index 54543bed0f8d355c72ec37a09b0dbb2ede7b45fd..a4eda3923d653f599882d051914ab83908d7c274 100644 (file)
@@ -39,6 +39,7 @@ class Popen3:
         specified, it specifies the size of the I/O buffers to/from the child
         process."""
         _cleanup()
+        self.cmd = cmd
         p2cread, p2cwrite = os.pipe()
         c2pread, c2pwrite = os.pipe()
         if capturestderr:
@@ -186,6 +187,9 @@ else:
     __all__.extend(["Popen3", "Popen4"])
 
 def _test():
+    # When the test runs, there shouldn't be any open pipes
+    _cleanup()
+    assert not _active, "Active pipes when test starts " + repr([c.cmd for c in _active])
     cmd  = "cat"
     teststr = "ab cd\n"
     if os.name == "nt":
index 402d075e3e676f926af6c8d4cc88bc48f17fd4f7..ba078b26869e244d492b631485f718c9dcab497b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -483,6 +483,8 @@ Extension Modules
 Library
 -------
 
+- popen2.Popen objects now preserve the command in a .cmd attribute.
+
 - Added the ctypes ffi package.
 
 - email 4.0 package now integrated.  This is largely the same as the email 3.0