def check_output()

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


def check_output(cmd: List[str], *args: Any, **kwargs: Any) -> Any:
    if not cmd or not cmd[0]:
        raise RuntimeError(
            "Could not run the following command {}. Please check your PATH".format(cmd)
        )
    kwargs["stderr"] = kwargs.pop("stderr", STDOUT)
    shlexed = " ".join([shlex.quote(x) for x in cmd])
    logging.trace("Running '%s'", shlexed)
    _QCMD_LOGGER.info(shlexed)
    try:
        return _check_output(cmd, *args, **kwargs).decode()
    except Exception as e:
        logging.error("'%s' failed: %s", shlexed, str(e))
        _QCMD_LOGGER.error(">> %s", str(e))
        raise