mpas_tools.logging.check_call

mpas_tools.logging.check_call(args, logger, log_command=True, timeout=None, **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 pass shell=True as one of the kwargs.

  • logger (logging.Logger) – The logger to write output to

  • log_command (bool, optional) – Whether to write the command that is running ot the logger

  • timeout (int, optional) – A timeout in seconds for the call

  • **kwargs (dict) – Keyword arguments to pass to subprocess.Popen

Raises

subprocess.CalledProcessError – If the given subprocess exists with nonzero status