mpas_tools.logging.check_call¶
- mpas_tools.logging.check_call(args, logger, log_command=True, **kwargs)[source]¶
Call the given subprocess with logging to the given logger.
- Parameters
args (list or str) – A list or string of argument to the subprocess. If
args
is a string, you must passshell=True
as one of thekwargs
.logger (logging.Logger) – The logger to write output to
log_command (bool, optional) – Whether to write the command that is running ot the logger
**kwargs (dict) – Keyword arguments to pass to subprocess.Popen
- Raises
subprocess.CalledProcessError – If the given subprocess exists with nonzero status