summaryrefslogtreecommitdiff
path: root/pexpect/utils.py
diff options
context:
space:
mode:
authorDavid Cullen <david.cullen@technicolor.com>2016-06-29 12:00:37 -0400
committerDavid Cullen <david.cullen@technicolor.com>2016-06-29 12:00:37 -0400
commit5655041074ec01214426472e6661878446bd5ab3 (patch)
treeb54acc0040c2ba9ca9d6336967bae35e02ec9713 /pexpect/utils.py
parentdd93bad924a011d73b03d69bdc76cb1b93a30520 (diff)
downloadpexpect-5655041074ec01214426472e6661878446bd5ab3.tar.gz
Alias select.error to InterruptedError.
Diffstat (limited to 'pexpect/utils.py')
-rw-r--r--pexpect/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pexpect/utils.py b/pexpect/utils.py
index a6e5aed..c8c2c9d 100644
--- a/pexpect/utils.py
+++ b/pexpect/utils.py
@@ -5,6 +5,12 @@ import select
import time
import errno
+try:
+ InterruptedError
+except NameError:
+ # Alias Python2 exception to Python3
+ InterruptedError = select.error
+
def is_executable_file(path):
"""Checks that path is an executable regular file, or a symlink towards one.
@@ -129,7 +135,7 @@ def select_ignore_interrupts(iwtd, owtd, ewtd, timeout=None):
while True:
try:
return select.select(iwtd, owtd, ewtd, timeout)
- except select.error:
+ except InterruptedError:
err = sys.exc_info()[1]
if err.args[0] == errno.EINTR:
# if we loop back we have to subtract the