fixed delay in daemon stopping

Former-commit-id: 1d9fa990582c214f3f40d1a10e97accfc38e3468
This commit is contained in:
Arthur Lu 2021-08-11 23:37:57 +00:00
parent 3a068654ed
commit 30641e43d8

View File

@ -293,9 +293,11 @@ def stop(pid_path):
return return
try: try:
os.kill(pid, SIGTERM) while True:
return os.kill(pid, SIGTERM)
time.sleep(0.01)
except OSError as err: except OSError as err:
err = str(err)
if err.find("No such process") > 0: if err.find("No such process") > 0:
if os.path.exists(pid_path): if os.path.exists(pid_path):
os.remove(pid_path) os.remove(pid_path)