Skip to content

Commit 50becc8

Browse files
committed
Handle shutdown exceptions
1 parent 20d7965 commit 50becc8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/notification_proc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ def stop():
5757

5858

5959
async def _server():
60+
from common import structs
6061
from modules import globals
6162

6263
while True:
63-
data = await pipe.get_async()
64+
try:
65+
data = await pipe.get_async()
66+
except structs.DaemonPipe.DaemonPipeExit:
67+
return
6468

6569
try:
6670
event, args, kwargs = data
@@ -173,4 +177,7 @@ def daemon(*args, **kwargs):
173177
import rubicon.objc.eventloop as cfloop
174178
asyncio.set_event_loop_policy(cfloop.EventLoopPolicy())
175179

176-
asyncio.run(_daemon(*args, **kwargs))
180+
try:
181+
asyncio.run(_daemon(*args, **kwargs))
182+
except KeyboardInterrupt:
183+
pass

0 commit comments

Comments
 (0)