diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-07-28 09:42:57 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-07-28 09:42:57 (GMT) |
commit | 6c611fae53eeb2e4e5c2db4fc634779fbcdf33eb (patch) | |
tree | b68bdbdbd3d832aadf493fcb7955e45bf2dcbf68 | |
parent | d694c1faf9314c9c531db59d24f90223cf720583 (diff) | |
download | cpython-6c611fae53eeb2e4e5c2db4fc634779fbcdf33eb.zip cpython-6c611fae53eeb2e4e5c2db4fc634779fbcdf33eb.tar.gz cpython-6c611fae53eeb2e4e5c2db4fc634779fbcdf33eb.tar.bz2 |
Patch #581705: Catch OSError, termios.error in spawn. 2.2 bugfix candidate.
-rw-r--r-- | Lib/pty.py | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -154,9 +154,14 @@ def spawn(argv, master_read=_read, stdin_read=_read): pid, master_fd = fork() if pid == CHILD: apply(os.execlp, (argv[0],) + argv) - mode = tty.tcgetattr(STDIN_FILENO) - tty.setraw(STDIN_FILENO) + try: + mode = tty.tcgetattr(STDIN_FILENO) + tty.setraw(STDIN_FILENO) + restore = 1 + except tty.error: # This is the same as termios.error + restore = 0 try: _copy(master_fd, master_read, stdin_read) - except IOError: - tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) + except (IOError, OSError): + if restore: + tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) |