aboutsummaryrefslogtreecommitdiffstats
path: root/termcast_client/pity.py
diff options
context:
space:
mode:
authorThomas Ballinger <thomasballinger@gmail.com>2014-10-16 21:36:20 -0400
committerThomas Ballinger <thomasballinger@gmail.com>2014-10-16 21:37:55 -0400
commit31cea814977c32b02bf9166cf4490f70e9861d1c (patch)
treef2ff4e93abde9e7406c9c8a08710d42c0f6380b8 /termcast_client/pity.py
parent597219dbcddb3e49090a2b5ae883a1e2935bf836 (diff)
downloadpython-termcast-client-31cea814977c32b02bf9166cf4490f70e9861d1c.tar.gz
python-termcast-client-31cea814977c32b02bf9166cf4490f70e9861d1c.zip
Add Python 2 compatibility
Diffstat (limited to 'termcast_client/pity.py')
-rw-r--r--termcast_client/pity.py9
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