kill code log
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user