Skip to content

Instantly share code, notes, and snippets.

@perbu
Created March 6, 2015 19:03
Show Gist options
  • Save perbu/f492d25448bde3f6de12 to your computer and use it in GitHub Desktop.
Save perbu/f492d25448bde3f6de12 to your computer and use it in GitHub Desktop.
subprocess is lame
#!/usr/local/bin/python
import subprocess
output = "not set"
try:
output = subprocess.check_output(["ls", "/", "/foo"])
print "success!"
print(output)
except subprocess.CalledProcessError:
print "fail!"
print output # will output "not set"
print "finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment