shared.command_execution
- shared.command_execution.execute_command(command: str, write_stream=True, _logger=None) -> (<class 'int'>, <class 'list'>, <class 'list'>)[source]
Execute a shell command and capture the standard output and standard error streams.
- Parameters:
command (str) – The shell command to execute.
write_stream (bool, optional) – Flag indicating whether to write the output streams to the log, defaults to True.
_logger (logging.Logger, optional) – A logger instance to use for logging, defaults to None, in which case the global logger is used.
- Returns:
The return code of the command, and the standard output and standard error captured as lists.
- Return type:
tuple(int, list, list)
- Raises:
CalledProcessError – If the command returns a non-zero exit status.