Exit cleanly when worker processes are missing.
This commit is contained in:
parent
f1902a4d1b
commit
1e45001878
1 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
# Licensed under the Artistic License 2.0.
|
# Licensed under the Artistic License 2.0.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
|
|
@ -74,6 +75,7 @@ class Worker:
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
if self.child_pgid is not None:
|
if self.child_pgid is not None:
|
||||||
|
with contextlib.suppress(ProcessLookupError):
|
||||||
os.killpg(self.child_pgid, signal.SIGKILL)
|
os.killpg(self.child_pgid, signal.SIGKILL)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue