summaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-29 02:09:22 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-29 02:09:22 +0000
commit7087600444743c5b8675bc5e034bac0988d72980 (patch)
tree854a0ada22492870f45c048bd2af92997d13e26e /pym
parentFor bug #186876, fall back it os.pipe() if pty.openpty() fails. (diff)
downloadportage-idfetch-7087600444743c5b8675bc5e034bac0988d72980.tar.gz
portage-idfetch-7087600444743c5b8675bc5e034bac0988d72980.tar.bz2
portage-idfetch-7087600444743c5b8675bc5e034bac0988d72980.zip
For pty logging, handle the EAGAIN error that is thrown from fcntl when the slave end of the pty is closed on FreeBSD.
svn path=/main/trunk/; revision=7424
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index b4c297e2..e5730203 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2469,8 +2469,16 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
for f in events[0]:
# Use non-blocking mode to prevent read
# calls from blocking indefinitely.
- fcntl.fcntl(f.fileno(), fcntl.F_SETFL,
- fd_flags[f] | os.O_NONBLOCK)
+ try:
+ fcntl.fcntl(f.fileno(), fcntl.F_SETFL,
+ fd_flags[f] | os.O_NONBLOCK)
+ except EnvironmentError, e:
+ if e.errno != errno.EAGAIN:
+ raise
+ del e
+ # The EAGAIN error signals eof on FreeBSD.
+ eof = True
+ break
buf = array.array('B')
try:
buf.fromfile(f, buffsize)