* [gentoo-commits] portage r14449 - main/trunk/pym/portage
@ 2009-09-27 19:45 99% Zac Medico (zmedico)
0 siblings, 0 replies; 1+ results
From: Zac Medico (zmedico) @ 2009-09-27 19:45 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2009-09-27 19:45:09 +0000 (Sun, 27 Sep 2009)
New Revision: 14449
Modified:
main/trunk/pym/portage/__init__.py
Log:
Make _test_pty_eof() use non-blocking IO, required for Darwin kernel.
Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py 2009-09-27 19:07:57 UTC (rev 14448)
+++ main/trunk/pym/portage/__init__.py 2009-09-27 19:45:09 UTC (rev 14449)
@@ -3746,7 +3746,7 @@
Raises an EnvironmentError from openpty() if it fails.
"""
- import array, pty, termios
+ import array, fcntl, pty, select, termios
test_string = 2 * "blah blah blah\n"
test_string = _unicode_decode(test_string,
encoding='utf_8', errors='strict')
@@ -3757,6 +3757,10 @@
master_file = os.fdopen(master_fd, 'rb')
slave_file = os.fdopen(slave_fd, 'wb')
+ # Non-blocking mode is required for Darwin kernel.
+ fcntl.fcntl(master_fd, fcntl.F_SETFL,
+ fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+
# Disable post-processing of output since otherwise weird
# things like \n -> \r\n transformations may occur.
mode = termios.tcgetattr(slave_fd)
@@ -3771,9 +3775,17 @@
eof = False
data = []
+ iwtd = [master_file]
+ owtd = []
+ ewtd = []
while not eof:
+ events = select.select(iwtd, owtd, ewtd)
+ if not events[0]:
+ eof = True
+ break
+
buf = array.array('B')
try:
buf.fromfile(master_file, 1024)
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2009-09-27 19:45 99% [gentoo-commits] portage r14449 - main/trunk/pym/portage Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox