Last active
August 29, 2015 14:18
-
-
Save detly/d30e7382e6de18d17615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import pexpect | |
def main(): | |
cmd = ' '.join([ | |
sys.executable, | |
'-c \'raise SystemExit("Blorp")\'' | |
]) | |
p = pexpect.spawn(cmd) | |
while True: | |
try: | |
_ = p.expect_exact('\n') | |
print("1. before: {:s}".format(repr(p.before))) | |
except pexpect.EOF as e: | |
print("2. before: {:s}".format(repr(p.before))) | |
break | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment