Make _test_pty_eof() return None if openpty() fails.
authorZac Medico <zmedico@gentoo.org>
Thu, 24 Sep 2009 21:48:07 +0000 (21:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 24 Sep 2009 21:48:07 +0000 (21:48 -0000)
svn path=/main/trunk/; revision=14414

pym/portage/__init__.py

index e04e37a828cb78a2af705e9feb11b18d7cb063f4..1595157760f01b9ab2d7571657952a09f059d141 100644 (file)
@@ -3743,6 +3743,8 @@ 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.
        """
 
        import array, pty, termios
@@ -3753,7 +3755,9 @@ def _test_pty_eof():
        try:
                master_fd, slave_fd = pty.openpty()
        except EnvironmentError:
-               return False
+               global _disable_openpty
+               _disable_openpty = True
+               return None
 
        master_file = os.fdopen(master_fd, 'rb')
        slave_file = os.fdopen(slave_fd, 'wb')