From 3cc6206d065b928f3cad2114b914930a110e6c51 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 23 Feb 2024 15:21:56 +0100 Subject: [PATCH] Extend execute_live to handle input use the new functionality for docker drun --- .../ddadevops/infrastructure/infrastructure.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index 9712b7f..48b24c9 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -58,8 +58,8 @@ class ImageApi: ) def drun(self, name: str): - self.execution_api.execute( - f'docker run -it --entrypoint="" {name} /bin/bash' + self.execution_api.execute_live( + f'docker run -it {name} /bin/bash' ) def dockerhub_login(self, username: str, password: str): @@ -121,13 +121,10 @@ class ExecutionApi: if dry_run: print(command) else: - process = Popen(command, stdout=PIPE, shell=shell) - for line in iter(process.stdout.readline, b""): - print(line.decode("utf-8"), end="") - process.stdout.close() - return_code = process.wait() - if return_code != 0: - raise RuntimeError(f"Execute live failed with code: {return_code}") + process = Popen(command, shell=shell) + outs, _ = process.communicate() + while outs is not None: + stdout.buffer.write(outs) class EnvironmentApi: