Here\'s the Python code to run an arbitrary command returning its stdout data, or raise an exception on non-zero exit codes:
stdout
proc = subprocess.P
Although I haven't looked at it extensively, this decorator I found at ActiveState seems to be quite useful for this sort of thing. Along with subprocess.Popen(..., close_fds=True), at least I'm ready for shell-scripting in Python.
subprocess.Popen(..., close_fds=True)