From 0cfcc7eb593f62473cc0cd50deb9fe8d97608272 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Thu, 4 Nov 2010 22:47:10 +0000 Subject: 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. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1031315 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/brokertest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/qpid/brokertest.py b/python/qpid/brokertest.py index 165d2d3811..8cf05c8161 100644 --- a/python/qpid/brokertest.py +++ b/python/qpid/brokertest.py @@ -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)) -- cgit v1.2.1