Skip to content

Instantly share code, notes, and snippets.

@yuuichi-fujioka
Created July 25, 2013 05:17
Show Gist options
  • Save yuuichi-fujioka/6077077 to your computer and use it in GitHub Desktop.
Save yuuichi-fujioka/6077077 to your computer and use it in GitHub Desktop.
The snippet of python subprocess
import subprocess
p = subprocess.Popen(
['ls', '-l'],
cwd='/tmp',
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
p.wait()
print p.stdout.read()
print p.stderrread()
print p.returncode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment