def _wait_for_containers_exit_status(self, containers):
"""Wait for all of the specified containers to exit
and return their exit codes.
Args:
containers (list of str): The containers to wait to exit.
Returns:
list of int: The list of return codes for the process in each
container.
"""
wait = ['docker', 'wait'] + containers
handle = subprocess.Popen(
args=wait,
stdout=subprocess.PIPE,
universal_newlines=True)
try:
output, _ = handle.communicate(timeout=35)
return [int(e) for e in output.strip().split('\n')]
except subprocess.TimeoutExpired:
handle.kill()
LOGGER.warning("Docker timed out waiting for %s to exit",
containers)
return []
评论列表
文章目录