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
Prepending the Linux command timeout isn't a bad workaround and it worked for me.
timeout
cmd = "timeout 20 "+ cmd subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) (output, err) = p.communicate()