Extend execute_live to handle input
use the new functionality for docker drun
This commit is contained in:
parent
48452baac5
commit
3cc6206d06
1 changed files with 6 additions and 9 deletions
|
@ -58,8 +58,8 @@ class ImageApi:
|
||||||
)
|
)
|
||||||
|
|
||||||
def drun(self, name: str):
|
def drun(self, name: str):
|
||||||
self.execution_api.execute(
|
self.execution_api.execute_live(
|
||||||
f'docker run -it --entrypoint="" {name} /bin/bash'
|
f'docker run -it {name} /bin/bash'
|
||||||
)
|
)
|
||||||
|
|
||||||
def dockerhub_login(self, username: str, password: str):
|
def dockerhub_login(self, username: str, password: str):
|
||||||
|
@ -121,13 +121,10 @@ class ExecutionApi:
|
||||||
if dry_run:
|
if dry_run:
|
||||||
print(command)
|
print(command)
|
||||||
else:
|
else:
|
||||||
process = Popen(command, stdout=PIPE, shell=shell)
|
process = Popen(command, shell=shell)
|
||||||
for line in iter(process.stdout.readline, b""):
|
outs, _ = process.communicate()
|
||||||
print(line.decode("utf-8"), end="")
|
while outs is not None:
|
||||||
process.stdout.close()
|
stdout.buffer.write(outs)
|
||||||
return_code = process.wait()
|
|
||||||
if return_code != 0:
|
|
||||||
raise RuntimeError(f"Execute live failed with code: {return_code}")
|
|
||||||
|
|
||||||
|
|
||||||
class EnvironmentApi:
|
class EnvironmentApi:
|
||||||
|
|
Loading…
Reference in a new issue