Skip to content

Instantly share code, notes, and snippets.

@DasIch
Created January 26, 2013 16:30
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 DasIch/4643139 to your computer and use it in GitHub Desktop.
Save DasIch/4643139 to your computer and use it in GitHub Desktop.
while True:
print raw_input("Echo?")
import subprocess
process = subprocess.Popen(["python", "./echo.py"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
for i in xrange(10):
print i
assert process.stdout.read(len("Echo?\n")) == "Echo?"
message = "%d\n" % i
process.stdin.write(message)
assert process.stdout.read(len(message)) == message
process.terminate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment