summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-29 02:10:36 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-29 02:10:36 +0000
commit4c6eb5918380185ed143fe45e7da880f066521bf (patch)
tree71c5969796f4996e5cb7f99cd84b4604cd6b116b /pym
parentd24538b602c3cc6b2d22c25f333f3829bbc3cdc2 (diff)
downloadportage-4c6eb5918380185ed143fe45e7da880f066521bf.tar.gz
portage-4c6eb5918380185ed143fe45e7da880f066521bf.tar.bz2
portage-4c6eb5918380185ed143fe45e7da880f066521bf.zip
For pty logging, handle the EAGAIN error that is thrown from fcntl when the slave end of the pty is closed on FreeBSD. (trunk r7424)
svn path=/main/branches/2.1.2/; revision=7425
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 1b97fa855..2cd342e5a 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2420,8 +2420,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)