Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker-container-exec_run] ExecDetachResult structure for exec_run in detached mode #3295

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docker/models/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ def exec_run(self, cmd, stdout=True, stderr=True, stdin=False, tty=False,
resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket,
demux=demux
)
if detach:
return ExecDetachResult(
resp["Id"],
self.client.api.exec_inspect(resp["Id"])["ExitCode"],
self.client.api.exec_inspect(resp["Id"])["Running"],
)
if socket or stream:
return ExecResult(None, exec_output)

Expand Down Expand Up @@ -1196,3 +1202,6 @@ def _host_volume_from_bind(bind):
ExecResult = namedtuple('ExecResult', 'exit_code,output')
""" A result of Container.exec_run with the properties ``exit_code`` and
``output``. """
ExecDetachResult = namedtuple('ExecDetachResult', 'id,exit_code,status')
""" A result of Container.exec_run in detached mode
with the properties ``id``, ``exit_code`` and ``status``. """