Kaydet (Commit) ad208dfd authored tarafından Frank Sachsenheim's avatar Frank Sachsenheim

Container.exec_run returns None as exit_code if stream or socket

Signed-off-by: 's avatarFrank Sachsenheim <funkyfuture@riseup.net>
üst 9c0332eb
...@@ -152,7 +152,8 @@ class Container(Model): ...@@ -152,7 +152,8 @@ class Container(Model):
Returns: Returns:
(tuple): A tuple of (exit_code, output) (tuple): A tuple of (exit_code, output)
exit_code: (int): 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): output: (generator or str):
If ``stream=True``, a generator yielding response chunks. If ``stream=True``, a generator yielding response chunks.
If ``socket=True``, a socket object for the connection. If ``socket=True``, a socket object for the connection.
...@@ -170,10 +171,11 @@ class Container(Model): ...@@ -170,10 +171,11 @@ class Container(Model):
exec_output = self.client.api.exec_start( exec_output = self.client.api.exec_start(
resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket
) )
exit_code = 0 if socket or stream:
if stream is False: return None, exec_output
exit_code = self.client.api.exec_inspect(resp['Id'])['ExitCode'] else:
return (exit_code, exec_output) return (self.client.api.exec_inspect(resp['Id'])['ExitCode'],
exec_output)
def export(self): def export(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment