summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/AsynchronousLock.py4
-rw-r--r--pym/_emerge/EbuildMetadataPhase.py23
-rw-r--r--pym/_emerge/PipeReader.py25
3 files changed, 29 insertions, 23 deletions
diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index 39e36c880..9d0545beb 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -138,7 +138,7 @@ class _LockThread(AbstractPollTask):
if event & PollConstants.POLLIN:
try:
buf = os.read(self._files['pipe_read'], self._bufsize)
- except IOError as e:
+ except OSError as e:
if e.errno not in (errno.EAGAIN,):
raise
if buf:
@@ -274,7 +274,7 @@ class _LockProcess(AbstractPollTask):
if event & PollConstants.POLLIN:
try:
buf = os.read(self._files['pipe_in'], self._bufsize)
- except IOError as e:
+ except OSError as e:
if e.errno not in (errno.EAGAIN,):
raise
if buf:
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index e068e8f24..d4f5bc009 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -112,16 +112,19 @@ class EbuildMetadataPhase(SubProcess):
def _output_handler(self, fd, event):
if event & PollConstants.POLLIN:
- try:
- self._raw_metadata.append(
- os.read(self._files.ebuild, self._bufsize))
- except IOError as e:
- if e.errno not in (errno.EAGAIN,):
- raise
- else:
- if not self._raw_metadata[-1]:
- self._unregister()
- self.wait()
+ while True:
+ try:
+ self._raw_metadata.append(
+ os.read(self._files.ebuild, self._bufsize))
+ except OSError as e:
+ if e.errno not in (errno.EAGAIN,):
+ raise
+ break
+ else:
+ if not self._raw_metadata[-1]:
+ self._unregister()
+ self.wait()
+ break
self._unregister_if_appropriate(event)
diff --git a/pym/_emerge/PipeReader.py b/pym/_emerge/PipeReader.py
index 67144c393..af8cfdd4e 100644
--- a/pym/_emerge/PipeReader.py
+++ b/pym/_emerge/PipeReader.py
@@ -59,18 +59,21 @@ class PipeReader(AbstractPollTask):
if event & PollConstants.POLLIN:
- data = None
- try:
- data = os.read(fd, self._bufsize)
- except IOError as e:
- if e.errno not in (errno.EAGAIN,):
- raise
- else:
- if data:
- self._read_data.append(data)
+ while True:
+ data = None
+ try:
+ data = os.read(fd, self._bufsize)
+ except OSError as e:
+ if e.errno not in (errno.EAGAIN,):
+ raise
+ break
else:
- self._unregister()
- self.wait()
+ if data:
+ self._read_data.append(data)
+ else:
+ self._unregister()
+ self.wait()
+ break
self._unregister_if_appropriate(event)