def command_output(cmd, shell=False):
 cmd = convert_command_args(cmd)
 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell)
 (stdout, stderr) = proc.communicate()
 if proc.returncode:
  raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd), output=(stdout + stderr))
 return stdout

def command_output ( cmd , shell = False ) : cmd = convert_command_args ( cmd ) proc = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE , close_fds = ( platform . system ( ) != 'Windows' ) , shell = shell ) ( stdout , stderr ) = proc . communicate ( ) if proc . returncode : raise subprocess . CalledProcessError ( returncode = proc . returncode , cmd = ' ' . join ( cmd ) , output = ( stdout + stderr ) ) return stdout
runs the command and returns its output after it has exited .