mirror of https://github.com/docker/docker-py.git
Container.exec_run returns None as exit_code if stream or socket
Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
This commit is contained in:
parent
9c0332eb2e
commit
ad208dfd29
|
@ -152,7 +152,8 @@ class Container(Model):
|
|||
Returns:
|
||||
(tuple): A tuple of (exit_code, output)
|
||||
exit_code: (int):
|
||||
Exit code for the executed command
|
||||
Exit code for the executed command or ``None`` if
|
||||
either ``stream```or ``socket`` is ``True``.
|
||||
output: (generator or str):
|
||||
If ``stream=True``, a generator yielding response chunks.
|
||||
If ``socket=True``, a socket object for the connection.
|
||||
|
@ -170,10 +171,11 @@ class Container(Model):
|
|||
exec_output = self.client.api.exec_start(
|
||||
resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket
|
||||
)
|
||||
exit_code = 0
|
||||
if stream is False:
|
||||
exit_code = self.client.api.exec_inspect(resp['Id'])['ExitCode']
|
||||
return (exit_code, exec_output)
|
||||
if socket or stream:
|
||||
return None, exec_output
|
||||
else:
|
||||
return (self.client.api.exec_inspect(resp['Id'])['ExitCode'],
|
||||
exec_output)
|
||||
|
||||
def export(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue