diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-16 23:28:46 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-16 23:28:46 -0400 |
commit | 8f9a3c5831afa6e2710bed3dbe3f2502cefc0ef0 (patch) | |
tree | f2ff4e93abde9e7406c9c8a08710d42c0f6380b8 /termcast_client/pity.py | |
parent | 597219dbcddb3e49090a2b5ae883a1e2935bf836 (diff) | |
parent | 31cea814977c32b02bf9166cf4490f70e9861d1c (diff) | |
download | python-termcast-client-8f9a3c5831afa6e2710bed3dbe3f2502cefc0ef0.tar.gz python-termcast-client-8f9a3c5831afa6e2710bed3dbe3f2502cefc0ef0.zip |
Merge pull request #1 from thomasballinger/python2-compat
Add Python 2 compatibility
Diffstat (limited to 'termcast_client/pity.py')
-rw-r--r-- | termcast_client/pity.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/termcast_client/pity.py b/termcast_client/pity.py index 26a9e49..966c793 100644 --- a/termcast_client/pity.py +++ b/termcast_client/pity.py @@ -1,3 +1,4 @@ +import errno import fcntl import os import pty @@ -5,6 +6,8 @@ import signal import termios import tty +from . import py2compat + CHILD = pty.CHILD STDIN_FILENO = pty.STDIN_FILENO STDOUT_FILENO = pty.STDOUT_FILENO @@ -68,9 +71,9 @@ def spawn(argv, master_read=pty._read, stdin_read=pty._read, handle_window_size= while True: try: pty._copy(master_fd, master_read, stdin_read) - except InterruptedError: - continue - except OSError: + except OSError as e: + if e.errno == errno.EINTR: + continue if restore: tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) break |