Author: shuston
Date: Thu Nov  4 22:47:10 2010
New Revision: 1031315

URL: http://svn.apache.org/viewvc?rev=1031315&view=rev
Log:
Adjust for Windows which can't do Popen w/ close_fds. Also, when tearDown runs, 
clear stopem so previously torn down processes don't throw confusing exceptions 
later.

Modified:
    qpid/trunk/qpid/python/qpid/brokertest.py

Modified: qpid/trunk/qpid/python/qpid/brokertest.py
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/brokertest.py?rev=1031315&r1=1031314&r2=1031315&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/brokertest.py (original)
+++ qpid/trunk/qpid/python/qpid/brokertest.py Thu Nov  4 22:47:10 2010
@@ -153,7 +153,10 @@ class Popen(subprocess.Popen):
         self.cmd  = [ str(x) for x in cmd ]
         self.returncode = None
         self.expect = expect
-        subprocess.Popen.__init__(self, self.cmd, 0, None, subprocess.PIPE, 
subprocess.PIPE, subprocess.PIPE, close_fds=True)
+        try:
+            subprocess.Popen.__init__(self, self.cmd, 0, None, 
subprocess.PIPE, subprocess.PIPE, subprocess.PIPE, close_fds=True)
+        except ValueError:     # Windows can't do close_fds
+            subprocess.Popen.__init__(self, self.cmd, 0, None, 
subprocess.PIPE, subprocess.PIPE, subprocess.PIPE)
         self.pname = "%s-%d" % (os.path.split(self.cmd[0])[1], self.pid)
         msg = "Process %s" % self.pname
         self.stdin = ExceptionWrapper(self.stdin, msg)
@@ -487,6 +490,7 @@ class BrokerTest(TestCase):
         for p in self.stopem:
             try: p.stop()
             except Exception, e: err.append(str(e))
+        self.stopem = []                # reset in case more processes start
         os.chdir(self.rootdir)
         if err: raise Exception("Unexpected process status:\n    "+"\n    
".join(err))
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to