$OpenBSD: patch-pyx_text_py,v 1.1.1.1 2007/12/31 11:32:30 eric Exp $
--- pyx/text.py.orig	Fri Jul 20 17:18:31 2007
+++ pyx/text.py	Fri Nov 30 17:39:37 2007
@@ -620,11 +620,17 @@ class _readpipe(threading.Thread):
         self.gotqueue = gotqueue
         self.quitevent = quitevent
         self.expect = None
-        self.start()
 
     def run(self):
         """thread routine"""
-        read = self.pipe.readline() # read, what comes in
+        def _read():
+            while 1:
+                try:
+                    return self.pipe.readline()
+                except IOError, e:
+                    if e.errno not in (4, ): # interrupted
+                        raise
+        read = _read() # read, what comes in
         try:
             self.expect = self.expectqueue.get_nowait() # read, what should be expected
         except Queue.Empty:
@@ -636,7 +642,7 @@ class _readpipe(threading.Thread):
             self.gotqueue.put(read) # report, whats read
             if self.expect is not None and read.find(self.expect) != -1:
                 self.gotevent.set() # raise the got event, when the output was expected (XXX: within a single line)
-            read = self.pipe.readline() # read again
+            read = _read() # read again
             try:
                 self.expect = self.expectqueue.get_nowait()
             except Queue.Empty:
@@ -899,6 +905,7 @@ class texrunner:
             self.fontmap = dvifile.readfontmap(self.fontmaps.split())
             oldpreamblemode = self.preamblemode
             self.preamblemode = 1
+            self.readoutput.start()
             self.execute("\\scrollmode\n\\raiseerror%\n" # switch to and check scrollmode
                          "\\def\\PyX{P\\kern-.3em\\lower.5ex\hbox{Y}\kern-.18em X}%\n" # just the PyX Logo
                          "\\gdef\\PyXBoxHAlign{0}%\n" # global PyXBoxHAlign (0.0-1.0) for the horizontal alignment, default to 0
