pysqa.base.core.execute_command

pysqa.base.core.execute_command#

pysqa.base.core.execute_command(commands: str | list[str], working_directory: str | None = None, split_output: bool = True, shell: bool = False, error_filename: str = 'pysqa.err') str | list[str] | None[source]#

A wrapper around the subprocess.check_output function.

Parameters:
  • commands (str) – The command(s) to be executed on the command line

  • working_directory (str, optional) – The directory where the command is executed. Defaults to None.

  • split_output (bool, optional) – Boolean flag to split newlines in the output. Defaults to True.

  • shell (bool, optional) – Additional switch to convert commands to a single string. Defaults to False.

  • error_filename (str, optional) – In case the execution fails, the output is written to this file. Defaults to “pysqa.err”.

Returns:

Output of the shell command either as a string or as a list of strings

Return type:

Union[str, List[str]]