scglue.utils.run_command
- scglue.utils.run_command(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, log_command=True, print_output=True, err_message=None, **kwargs)[source]
Run an external command and get realtime output
- Parameters
command (
str
) – A string containing the command to be executedstdout – Where to redirect stdout
stderr – Where to redirect stderr
echo_command – Whether to log the command being printed (log level is INFO)
print_output (
bool
) – Whether to print stdout of the command. Ifstdout
is PIPE andprint_output
is set to False, the output will be returned as a list of output lines.err_message (
typing.Optional
[typing.Mapping
[int
,str
]]) – Look up dict of error message (indexed by error code)**kwargs – Other keyword arguments to be passed to
subprocess.Popen
- Return type
- Returns
output_lines – A list of output lines (only returned if
stdout
is PIPE andprint_output
is False)