def execute_shell(cmd, ignore_errors=False):
    try:
        p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                stdout=subprocess.PIPE, close_fds=True)
        out, __ = p.communicate()
    except Exception, e:
        if not ignore_errors:
            raise e
    return out.rstrip()
Simple routine to execute shell commands.
dataset/ETHPy150Open brunobraga/termsaver/termsaverlib/common.py/execute_shell