asyncio signal handler that cancels all `tasks` and reports to stderr.
(tasks: Iterable[asyncio.Future[Any]])
| 48 | |
| 49 | |
| 50 | def cancel(tasks: Iterable[asyncio.Future[Any]]) -> None: |
| 51 | """asyncio signal handler that cancels all `tasks` and reports to stderr.""" |
| 52 | err("Aborted!") |
| 53 | for task in tasks: |
| 54 | task.cancel() |
| 55 | |
| 56 | |
| 57 | def shutdown(loop: asyncio.AbstractEventLoop) -> None: |