#NEWLINE# def run_cmd( cmd , cwd = None , encoding = 'utf-8' ) : #NEWLINE# #INDENT# p = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE , cwd = cwd ) #NEWLINE# ( stdout , stderr ) = p . communicate ( ) #NEWLINE# if ( p . returncode != 0 ) : #NEWLINE# #INDENT# raise processutils . ProcessExecutionError ( stdout = stdout , stderr = p , exit_code = p . returncode , cmd = cmd ) #NEWLINE# #UNINDENT# return ( stdout . decode ( encoding ) , stderr . decode ( encoding ) )