Skip to content

Commit b62ae1e

Browse files
committed
Ensure clean task cancellation
1 parent 62a988f commit b62ae1e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

juju/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ async def run_with_interrupt(task, *events, log=None):
181181
return_when=jasyncio.FIRST_COMPLETED)
182182
for f in pending:
183183
f.cancel() # cancel unfinished tasks
184+
try:
185+
await f
186+
except jasyncio.CancelledError:
187+
pass
184188
for f in done:
185189
f.exception() # prevent "exception was not retrieved" errors
186190
if task in done:

0 commit comments

Comments
 (0)