scglue.utils.run_command(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, log_command=True, print_output=True, err_message=None, **kwargs)[源代码]

Run an external command and get realtime output

  • command (str) – A string containing the command to be executed

  • stdout – 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. If stdout is PIPE and print_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




output_lines – A list of output lines (only returned if stdout is PIPE and print_output is False)