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

This commit is contained in:
Martin v. Löwis 2002-07-28 09:42:57 +00:00
parent d694c1faf9
commit 6c611fae53
1 changed files with 9 additions and 4 deletions

View File

@ -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)
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:
except (IOError, OSError):
if restore:
tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)