Skip to content

Commit c90859b

Browse files
committed
ExecDetachResult structure for exec_run in detached mode
Signed-off-by: Piotr Nowak <[email protected]>
1 parent a8bac88 commit c90859b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docker/models/containers.py

+9
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ def exec_run(self, cmd, stdout=True, stderr=True, stdin=False, tty=False,
215215
resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket,
216216
demux=demux
217217
)
218+
if detach:
219+
return ExecDetachResult(
220+
resp["Id"],
221+
self.client.api.exec_inspect(resp["Id"])["ExitCode"],
222+
self.client.api.exec_inspect(resp["Id"])["Running"],
223+
)
218224
if socket or stream:
219225
return ExecResult(None, exec_output)
220226

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

0 commit comments

Comments
 (0)