fetch_posts: add KeyboardInterrupt handling

This commit is contained in:
io 2021-07-26 06:17:01 +00:00
parent 4ba3bb1662
commit a3348602c1
1 changed files with 5 additions and 1 deletions

View File

@ -206,7 +206,11 @@ async def amain():
async with PostFetcher(config=config) as fetcher: await fetcher.fetch_all()
def main():
anyio.run(amain)
try:
anyio.run(amain)
except KeyboardInterrupt:
# suppress the lengthy traceback
sys.exit(1)
if __name__ == '__main__':
main()