clean up tasks

This commit is contained in:
xenia 2021-05-12 17:02:54 -04:00
parent bd0f41afce
commit 5bbd7372d1
1 changed files with 3 additions and 0 deletions

View File

@ -203,8 +203,11 @@ async def megacom_main(stdin: asyncio.StreamReader, stdout: asyncio.StreamWriter
elif handle_done(serial_to_stdout):
pass
time_to_exit.cancel()
stdin_to_serial.cancel()
serial_to_stdout.cancel()
with contextlib.suppress(asyncio.CancelledError):
await time_to_exit
with contextlib.suppress(asyncio.CancelledError):
with contextlib.suppress(serial.SerialException):
await stdin_to_serial