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:
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:
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)
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)