ethereum / async-service

Lifecycle management for async Python applications
MIT License
9 stars 13 forks source link

Handle KeyboardInterrupt in Asyncio services #63

Closed gsalgado closed 4 years ago

gsalgado commented 4 years ago

Closes: #62

pipermerriam commented 4 years ago

To extend on the previous comment, you probably want to consider something like this.

Anywhere that we have

try:
    ...
except Exception:
    ...

You can update to either of:

try:
    ...
except Exception:
    ...
except BaseException:
    ...  # if you need separate exception logic for KeyboardInterrupt

or this if the logic should be the same.

try:
    ...
except BaseException:
    ...