diff options
author | Depado <paul.lhussiez@gmail.com> | 2015-04-17 11:02:52 +0200 |
---|---|---|
committer | Depado <paul.lhussiez@gmail.com> | 2015-04-17 11:02:52 +0200 |
commit | aac5897aa12daf056b8fe08f1b6512d9f60c2d27 (patch) | |
tree | c604e6fef81a3d40e72b9ad65a6ecbb132d60ce2 | |
parent | 671417beb41c21f772687c565196fdde444b053b (diff) | |
download | pexpect-aac5897aa12daf056b8fe08f1b6512d9f60c2d27.tar.gz |
Fix issue 126 for 3.x branch
-rw-r--r-- | pexpect/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py index cace43b..acabf5a 100644 --- a/pexpect/__init__.py +++ b/pexpect/__init__.py @@ -490,7 +490,10 @@ class spawn(object): # inherit EOF and INTR definitions from controlling process. try: from termios import VEOF, VINTR - fd = sys.__stdin__.fileno() + try: + fd = sys.__stdin__.fileno() + except ValueError: + fd = sys.__stdout__.fileno() self._INTR = ord(termios.tcgetattr(fd)[6][VINTR]) self._EOF = ord(termios.tcgetattr(fd)[6][VEOF]) except (ImportError, OSError, IOError, termios.error): |