diff --git a/sling/sling/__init__.py b/sling/sling/__init__.py index d5d896b..a27993e 100644 --- a/sling/sling/__init__.py +++ b/sling/sling/__init__.py @@ -574,9 +574,13 @@ def stream(self, env:dict=None, stdin=None) -> Iterable[list]: # conform to legacy module Sling = Task -def _run(cmd: str, temp_file: str, return_output=False, env:dict=None, stdin=None): +def _run(cmd: str, temp_file: str, return_output=False, print_output=False, env:dict=None, stdin=None): """ - Runs the task. Use `return_output` as `True` to return the stdout+stderr output at end. `env` accepts a dictionary which defines the environment. + Runs the task. + + Use `return_output` as `True` to return the stdout+stderr output at end. + Use `print_output` as `True` to print to stdout as it runs. + `env` accepts a dictionary which defines the environment. """ lines = [] try: @@ -589,6 +593,8 @@ def _run(cmd: str, temp_file: str, return_output=False, env:dict=None, stdin=Non lines.append(line) else: print(line, flush=True) + if print_output: + print(line, flush=True) os.remove(temp_file)