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

Add example of Popen to expect on a process #3

Open
nastevens opened this issue Jan 21, 2016 · 1 comment
Open

Add example of Popen to expect on a process #3

nastevens opened this issue Jan 21, 2016 · 1 comment

Comments

@nastevens
Copy link
Contributor

The following example was generated in a Reddit discussion and would make an excellent example for the repo:

import streamexpect
from subprocess import Popen, PIPE

pipe = Popen(r'net accounts', shell=True, stdout=PIPE).stdout

with streamexpect.wrap(pipe) as stream:
    match = stream.expect_regex(r'Computer role:\s+(\S+)')
    print('Computer role: ' + match.groups[0])
@Hoohaha
Copy link

Hoohaha commented Nov 30, 2022

Can you add this in examples?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants