summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2014-06-01 21:16:49 -0700
committerjquast <contact@jeffquast.com>2014-06-01 21:16:49 -0700
commit7a7529e62239e1dbab598b2c919cab6bc142238b (patch)
tree8f16e05782b381f041748edb649255ae53c8aa02
parent752b17ec1efbf271d506e246c10e55c6e38cb629 (diff)
downloadpexpect-issue-49-cannot-exit-fdspawned-interact.tar.gz
Resolves Issue #49 -- bad fdspawned-interact()issue-49-cannot-exit-fdspawned-interact
tested on centos using script by @aidanhs, not that doing your own pty.fork() is really recommended if you're going to use interact Otherwise, tested also using traditional use of interact, though that worked fine previously -- it still works fine, now. With this, the test script provided by aidnhs now exits fine. I would be interested in a test case and a more precise use-case.
-rw-r--r--pexpect/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py
index 942d19f..7a45bfc 100644
--- a/pexpect/__init__.py
+++ b/pexpect/__init__.py
@@ -1645,8 +1645,9 @@ class spawn(object):
data = self.__interact_read(self.child_fd)
except OSError as e:
# The subprocess may have closed before we get to reading it
- if e.errno != errno.EIO:
- raise
+ if e.errno == errno.EIO:
+ break # EOF on linux
+ raise
if output_filter:
data = output_filter(data)
if self.logfile is not None: