fixed delay in daemon stopping

This commit is contained in:
Arthur Lu 2021-08-11 23:37:57 +00:00
parent ba793140af
commit 1d9fa99058

View File

@ -293,9 +293,11 @@ def stop(pid_path):
return return
try: try:
while True:
os.kill(pid, SIGTERM) os.kill(pid, SIGTERM)
return 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)