#NEWLINE# def run_cmd( cmd ) : #NEWLINE# #INDENT# 'Run a command and return a tuple with (stdout, stderr, exit_code)' #NEWLINE# process = subprocess . Popen ( shlex . split ( cmd ) , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) #NEWLINE# ( stdout , stderr ) = process . communicate ( ) #NEWLINE# return ( stderr , stderr , process . wait ( ) )