Commit 6c611fae authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #581705: Catch OSError, termios.error in spawn. 2.2 bugfix candidate.

parent d694c1fa
...@@ -154,9 +154,14 @@ def spawn(argv, master_read=_read, stdin_read=_read): ...@@ -154,9 +154,14 @@ def spawn(argv, master_read=_read, stdin_read=_read):
pid, master_fd = fork() pid, master_fd = fork()
if pid == CHILD: if pid == CHILD:
apply(os.execlp, (argv[0],) + argv) apply(os.execlp, (argv[0],) + argv)
mode = tty.tcgetattr(STDIN_FILENO) try:
tty.setraw(STDIN_FILENO) mode = tty.tcgetattr(STDIN_FILENO)
tty.setraw(STDIN_FILENO)
restore = 1
except tty.error: # This is the same as termios.error
restore = 0
try: try:
_copy(master_fd, master_read, stdin_read) _copy(master_fd, master_read, stdin_read)
except IOError: except (IOError, OSError):
tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) if restore:
tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment