pyslk.run_slk#
- pyslk.run_slk(slk_call: list | str, fun: str, env: str | None = None, retries_on_timeout: int = 0, handle_output: bool = True, wait_until_finished: bool = True) str | CompletedProcess | Popen #
Runs a provided slk_call via subprocess.run and returns stdout
The argument ‘slk_call’ is used as argument in a call of ‘subprocess.run(…)’. If slk_call is a string then ‘shell=True’ is set in the run(…)-call. Otherwise, the argument ‘shell’ is omitted.
If the command provided via ‘slk_call’ does not exist (e.g. ‘slk’ not available on this system) or if ‘slk’ returns an exit code ‘!= 0’ then a PySlkException is raised.
- Parameters:
slk_call (str or list of str) – slk call as input for subprocess.run
fun (str) – name of the calling pyslk function; printed when exception is raised
env (str) – environment string
retries_on_timeout (int) – run slk_helpers calls repeatedly ‘n’ times when exit code 3 (timeout) is returned
handle_output (bool) – whether to handle exceptions and parse outputs or just return outputs.
wait_until_finished (bool) – let this function run as long as the slk command is running
- Returns:
stdout of the slk call
- Return type:
str