Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replwrap: add async support #501

Merged
merged 2 commits into from
Jul 12, 2018
Merged

replwrap: add async support #501

merged 2 commits into from
Jul 12, 2018

Conversation

ThomasFaivre
Copy link
Contributor

Add an 'async_' argument to run_command. When True, a Future object will
be returned which must be awaited in asynchronous code.

Signed-off-by: Robin Jarry robin.jarry@6wind.com
Signed-off-by: Thomas Faivre thomas.faivre@6wind.com

@ThomasFaivre ThomasFaivre force-pushed the repl_async branch 2 times, most recently from 77b17f7 to ea893a6 Compare June 12, 2018 16:28
def _run_line(fut=None):
if len(cmdlines) < cmd_count:
# gather output after the first line has been sent
out.append(self.child.before)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This async recursive structure is not very easy to follow, in my opinion. Would it be better written as a coroutine?

rjarry and others added 2 commits June 19, 2018 17:27
Add an 'async_' argument to run_command. When True, a coroutine will be
returned which *must* be awaited in asynchronous code.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
@ThomasFaivre
Copy link
Contributor Author

Thanks for the very good point @takluyver
We thought we needed that because we couldn't use "yield from" in replwrap.py but we can simply use the _async module...
That looks way nicer!

@ThomasFaivre
Copy link
Contributor Author

Hello!
Just a quick status update. How soon can I expect this in the master branch? Is there anything I need to add?

Thanks!

@takluyver
Copy link
Member

Looks good to me, thanks.

@takluyver takluyver merged commit f481dbd into pexpect:master Jul 12, 2018
@ThomasFaivre ThomasFaivre deleted the repl_async branch July 16, 2018 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants