Skip to content

Instantly share code, notes, and snippets.

@detly
Last active August 29, 2015 14:18
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/d30e7382e6de18d17615 to your computer and use it in GitHub Desktop.
Save detly/d30e7382e6de18d17615 to your computer and use it in GitHub Desktop.
#!/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