Extend execute_live to handle input

use the new functionality for docker drun
This commit is contained in:
bom 2024-02-23 15:21:56 +01:00
parent 48452baac5
commit 3cc6206d06

View file

@ -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: