[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner.py Fix the flurry of "Error reading subprocess output for ...Layer" errors

Marius Gedminas marius at pov.lt
Sun Jul 15 08:38:44 EDT 2007


Log message for revision 77994:
  Fix the flurry of "Error reading subprocess output for ...Layer" errors
  when running the full Zope 3 test suite on Linux.
  
  

Changed:
  U   zope.testing/trunk/src/zope/testing/testrunner.py

-=-
Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py	2007-07-15 12:03:40 UTC (rev 77993)
+++ zope.testing/trunk/src/zope/testing/testrunner.py	2007-07-15 12:38:43 UTC (rev 77994)
@@ -24,6 +24,7 @@
 import logging
 import optparse
 import os
+import errno
 import pdb
 import re
 import sys
@@ -1227,11 +1228,20 @@
                 ])
 
         subin, subout, suberr = os.popen3(args)
-        try:
-            for l in subout:
-                sys.stdout.write(l)
-        except IOError:
-            output.error("Error reading subprocess output for %s" % layer_name)
+        while True:
+            try:
+                for l in subout:
+                    sys.stdout.write(l)
+            except IOError, e:
+                if e.errno == errno.EINTR:
+                    # If the subprocess dies before we finish reading its
+                    # output, a SIGCHLD signal can interrupt the reading.
+                    # The correct thing to to in that case is to retry.
+                    continue
+                output.error("Error reading subprocess output for %s" % layer_name)
+                output.info(str(e))
+            else:
+                break
 
         line = suberr.readline()
         try:



More information about the Zope3-Checkins mailing list