def run_command(cmd):
    """
    Open a child process, and return its exit status and stdout.

    """
    child = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE,
                             stdin=subprocess.PIPE, stdout=subprocess.PIPE)
    out = [s.decode("utf-8").strip() for s in child.stdout]
    err = [s.decode("utf-8").strip() for s in child.stderr]
    w = child.wait()
    return os.WEXITSTATUS(w), out, err
def run_command ( cmd ) : child = subprocess . Popen ( cmd , shell = True , stderr = subprocess . PIPE , stdin = subprocess . PIPE , stdout = subprocess . PIPE ) out = [ s . decode ( "utf-8" ) . strip ( ) for s in child . stdout ] err = [ s . decode ( "utf-8" ) . strip ( ) for s in child . stderr ] w = child . wait ( ) return os . WEXITSTATUS ( w ) , out , err
Open a child process, and return its exit status and stdout.