From: Zac Medico Date: Sun, 29 Jul 2007 02:10:36 +0000 (-0000) Subject: For pty logging, handle the EAGAIN error that is thrown from fcntl when the slave... X-Git-Tag: v2.1.2.11~86 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4c6eb5918380185ed143fe45e7da880f066521bf;p=portage.git 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 --- 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)