summaryrefslogtreecommitdiffstats
path: root/pym/portage/__init__.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-24 22:47:09 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-24 22:47:09 +0000
commitfcb82c635ed472a0df480142c0446ee4057d31ae (patch)
treea454ed83516a129d5487ea0c8d5512847ddc1f67 /pym/portage/__init__.py
parent3df9061abdeba371dabcab9754be90866ff1d0ad (diff)
downloadportage-fcb82c635ed472a0df480142c0446ee4057d31ae.tar.gz
portage-fcb82c635ed472a0df480142c0446ee4057d31ae.tar.bz2
portage-fcb82c635ed472a0df480142c0446ee4057d31ae.zip
Show an appropriate error message in _create_pty_or_pipe() if openpty()
fails inside _test_pty_eof(). svn path=/main/trunk/; revision=14417
Diffstat (limited to 'pym/portage/__init__.py')
-rw-r--r--pym/portage/__init__.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 159515776..9adab4baf 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -3743,8 +3743,7 @@ def _test_pty_eof():
"""
Returns True if this issues is fixed for the currently
running version of python: http://bugs.python.org/issue5380
- Returns None if openpty fails, and False if the above issue
- is not fixed.
+ Raises an EnvironmentError from openpty() if it fails.
"""
import array, pty, termios
@@ -3752,12 +3751,8 @@ def _test_pty_eof():
test_string = _unicode_decode(test_string,
encoding='utf_8', errors='strict')
- try:
- master_fd, slave_fd = pty.openpty()
- except EnvironmentError:
- global _disable_openpty
- _disable_openpty = True
- return None
+ # may raise EnvironmentError
+ master_fd, slave_fd = pty.openpty()
master_file = os.fdopen(master_fd, 'rb')
slave_file = os.fdopen(slave_fd, 'wb')
@@ -3820,9 +3815,15 @@ def _create_pty_or_pipe(copy_term_size=None):
got_pty = False
global _disable_openpty, _tested_pty
- if not _tested_pty:
- if not _test_pty_eof():
+ if not (_tested_pty or _disable_openpty):
+ try:
+ if not _test_pty_eof():
+ _disable_openpty = True
+ except EnvironmentError as e:
_disable_openpty = True
+ writemsg("openpty failed: '%s'\n" % str(e),
+ noiselevel=-1)
+ del e
_tested_pty = True
if _disable_openpty: