dominicparga/howto

Document how to pipe a cmd with subprocess

dominicparga opened this issue · 0 comments

Add documentation

https://stackoverflow.com/questions/11113896/use-git-commands-within-python-code

The following code (or similar) has worked.

import subprocess

cmd0 = '...'
cmd1 = '...'
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=p)
out, _err = p.communicate()

print(out)