Skip to content

Instantly share code, notes, and snippets.

@riywo
Created September 29, 2013 03:33
Show Gist options
  • Save riywo/6749121 to your computer and use it in GitHub Desktop.
Save riywo/6749121 to your computer and use it in GitHub Desktop.
from subprocess import Popen, PIPE
p = Popen(["cat"], stdin=PIPE, stdout=PIPE)
print "stdin.write"
p.stdin.write("aaa")
p.stdin.flush()
print "stdout.read"
print p.stdout.readlines()
p.stdin.close()
p.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment