From 4c6eb5918380185ed143fe45e7da880f066521bf Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 29 Jul 2007 02:10:36 +0000 Subject: [PATCH] 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 --- pym/portage.py | 12 ++++++++++-- 1 file 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) -- 2.26.2