run_command#
- astropop.py_utils.run_command(args, stdout=None, stderr=None, stdout_loglevel='DEBUG', stderr_loglevel='ERROR', logger=<Logger astropop (INFO)>, **kwargs)#
Run a command in command line with logging.
- Parameters:
- args: list of strings or string
Full command, with arguments, to be executed.
- stdout: list (optional)
List to store the stdout of the command. If None, a new list will be created.
- stderr: list (optional)
List to store the stderr of the command. If None, a new list will be created.
- stdout_loglevel: string (optional)
Log level to print the stdout lines. Default is ‘DEBUG’.
- stderr_loglevel: string (optional)
Log level to print the stderr lines. Default is ‘ERROR’.
- logger: `~logging.Logger` (optional)
Custom logger to print the outputs.
- **kwargs: dict (optional)
Additional arguments to be passed to
create_subprocess_shell
- Returns:
CompletedProcess
results of the execution.