mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
aioproc: use killpg() for SIGKILL
This commit is contained in:
parent
ab92a2d708
commit
487476afe4
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import asyncio
|
import asyncio
|
||||||
import asyncio.subprocess
|
import asyncio.subprocess
|
||||||
import logging
|
import logging
|
||||||
@ -96,7 +97,7 @@ async def kill_process(proc: asyncio.subprocess.Process, wait: float, logger: lo
|
|||||||
await asyncio.sleep(wait)
|
await asyncio.sleep(wait)
|
||||||
if proc.returncode is None:
|
if proc.returncode is None:
|
||||||
try:
|
try:
|
||||||
proc.kill()
|
os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
|
||||||
except Exception:
|
except Exception:
|
||||||
if proc.returncode is not None:
|
if proc.returncode is not None:
|
||||||
raise
|
raise
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user