Skip to content

Instantly share code, notes, and snippets.

@detly
Created March 30, 2015 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save detly/7be411010366f5a67467 to your computer and use it in GitHub Desktop.
Save detly/7be411010366f5a67467 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import asyncio
import sys
import pexpect
@asyncio.coroutine
def run():
cmd = ' '.join([
sys.executable,
'pexpect_bug_script.py'
])
p = pexpect.spawn(cmd)
while True:
_ = yield from p.expect_exact('\r', async=True)
data = p.before + p.after
print("Got: {:s}".format(repr(data)))
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
loop.close()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment