diff options
author | Jeff Quast <contact@jeffquast.com> | 2015-10-13 08:15:16 -0700 |
---|---|---|
committer | Jeff Quast <contact@jeffquast.com> | 2015-10-13 08:15:16 -0700 |
commit | cbcabfa97a1e0bb4ad6cb311bf9d94ea5f65e64a (patch) | |
tree | c335f866b69b7de7b0a5dd1f3d2b7691eb4adf86 | |
parent | 8a86932b770cd42ab1664b35a327b5f776b8c1df (diff) | |
parent | fa2a11658c0f188810b652e5bf79a10514eefb2c (diff) | |
download | pexpect-git-cbcabfa97a1e0bb4ad6cb311bf9d94ea5f65e64a.tar.gz |
Merge pull request #288 from takluyver/async-issue
Stop asyncio listening to pty once we've found what we need
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | pexpect/async.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml index 51c967d..251dfaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ python: - 2.7 - 3.3 - 3.4 + - 3.5 - pypy install: diff --git a/pexpect/async.py b/pexpect/async.py index a798457..136fc0e 100644 --- a/pexpect/async.py +++ b/pexpect/async.py @@ -23,6 +23,7 @@ def expect_async(expecter, timeout=None): return expecter.timeout(e) class PatternWaiter(asyncio.Protocol): + transport = None def __init__(self, expecter): self.expecter = expecter self.fut = asyncio.Future() @@ -30,10 +31,15 @@ class PatternWaiter(asyncio.Protocol): def found(self, result): if not self.fut.done(): self.fut.set_result(result) + self.transport.pause_reading() def error(self, exc): if not self.fut.done(): self.fut.set_exception(exc) + self.transport.pause_reading() + + def connection_made(self, transport): + self.transport = transport def data_received(self, data): spawn = self.expecter.spawn |