Make EbuildIpcDaemon._input_handler() handle EAGAIN from os.read()
authorZac Medico <zmedico@gentoo.org>
Fri, 24 Sep 2010 02:39:39 +0000 (19:39 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 24 Sep 2010 02:42:52 +0000 (19:42 -0700)
for FreeBSD (bug 337465, comment #35).

pym/_emerge/EbuildIpcDaemon.py

index d418fc80a4bfdd36dd7ede7b0471ef92d4765332..0c8ea3ea8c5144b11218cf885c305c4b420e803d 100644 (file)
@@ -36,7 +36,13 @@ class EbuildIpcDaemon(FifoIpcDaemon):
                        # array.fromfile() and file.read() are both known to
                        # erroneously return an empty string from this
                        # non-blocking fifo stream on FreeBSD (bug #337465).
-                       data = os.read(fd, self._bufsize)
+                       try:
+                               data = os.read(fd, self._bufsize)
+                       except OSError as e:
+                               if e.errno != errno.EAGAIN:
+                                       raise
+                               # Assume that another event will be generated
+                               # if there's any relevant data.
 
                if data: