mirror of https://github.com/docker/docker-py.git
Merge 9c878a2f74
into db7f8b8bb6
This commit is contained in:
commit
8c58b008a7
|
@ -894,7 +894,24 @@ class ContainerCollection(Collection):
|
||||||
stdout=stdout, stderr=stderr, stream=True, follow=True
|
stdout=stdout, stderr=stderr, stream=True, follow=True
|
||||||
)
|
)
|
||||||
|
|
||||||
exit_status = container.wait()['StatusCode']
|
if kwargs.get('auto_remove'):
|
||||||
|
wait_condition = 'removed'
|
||||||
|
else:
|
||||||
|
# the wait condition should theoretically be 'next-exit' (as is
|
||||||
|
# used by the cli), but it may have exited already if its run time
|
||||||
|
# was very short, which would cause the wait to hang.
|
||||||
|
# 'not-running' works in both cases.
|
||||||
|
wait_condition = 'not-running'
|
||||||
|
try:
|
||||||
|
exit_status = container.wait(condition=wait_condition)['StatusCode']
|
||||||
|
except NotFound:
|
||||||
|
if wait_condition == 'removed':
|
||||||
|
# it has been already removed, which is why it was not found,
|
||||||
|
# so everything fine here. unfortunately, there is no way to
|
||||||
|
# have its real exit status, so assume success.
|
||||||
|
exit_status = 0
|
||||||
|
else:
|
||||||
|
raise
|
||||||
if exit_status != 0:
|
if exit_status != 0:
|
||||||
out = None
|
out = None
|
||||||
if not kwargs.get('auto_remove'):
|
if not kwargs.get('auto_remove'):
|
||||||
|
|
Loading…
Reference in New Issue