#tricks
1 messages · Page 1 of 1 (latest)
async def wait_for_ct_until_cancelled(ct: dagger.Container):
"""Wait for a container to exit until the user cancels the operation."""
while True:
try:
await asyncio.sleep(1) # give the hand to the event loop for cancelation
return await asyncio.wait_for(ct.exit_code(), timeout=1)
except asyncio.TimeoutError:
pass