diff --git a/src/main/python/ddadevops/python_util.py b/src/main/python/ddadevops/python_util.py index 0ad4689..fef4ee0 100644 --- a/src/main/python/ddadevops/python_util.py +++ b/src/main/python/ddadevops/python_util.py @@ -1,4 +1,4 @@ -from subprocess import check_output +from subprocess import check_output, Popen, PIPE import sys def execute(cmd, shell=False): @@ -8,5 +8,12 @@ def execute(cmd, shell=False): output = check_output(cmd, shell=shell) return output.rstrip() +def execute_live(cmd): + p = Popen(cmd, stdout=PIPE) + for line in iter(p.stdout.readline, b''): + print(line.decode('utf-8'), end='') + p.stdout.close() + p.wait() + def filter_none(list): return [x for x in list if x is not None]