def call()

in gridengine/src/gridengine/qbin.py [0:0]


def call(cmd: List[str]) -> None:
    shlexed = " ".join([shlex.quote(x) for x in cmd])
    logging.trace("Running '%s'", shlexed)
    _QCMD_LOGGER.info(shlexed)
    stderr = ""
    completed_process = None
    try:
        # capture_output was added in 3.7 and we support as far back as 3.6
        if sys.version_info < (3, 7):
            completed_process = subprocess.run(cmd, stderr=subprocess.PIPE)
        else:
            completed_process = subprocess.run(cmd, capture_output=True)

        if completed_process.returncode != 0:
            if completed_process.stderr:
                stderr = completed_process.stderr.decode()
            logging.warning(
                "'%s' failed with exit %d: Stderr '%s'",
                shlexed,
                completed_process.returncode,
                stderr,
            )
    except Exception as e:
        logging.error("'%s' failed: %s.", shlexed, str(e))
        _QCMD_LOGGER.error(">> %s", str(e))
        raise