kill code log

This commit is contained in:
CakeCN
2025-09-12 15:50:03 +08:00
parent bf9bc625d6
commit 3d50c410bf

View File

@@ -207,11 +207,13 @@ class ChatManager:
try:
# 优雅:向进程组发 SIGTERM
os.killpg(pop.pid, signal.SIGTERM)
print("send SIGTERM to code-server")
except ProcessLookupError:
return True
# 等待优雅退出
try:
print("wait for code-server to exit")
pop.wait(timeout=grace_seconds)
return True
except subprocess.TimeoutExpired:
@@ -219,6 +221,7 @@ class ChatManager:
# 兜底:强杀进程组
try:
print("kill code-server")
os.killpg(pop.pid, signal.SIGKILL)
except ProcessLookupError:
pass