From b1e455ca488b5901d67c9b1ab1ac904d1a932822 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sun, 25 Jun 2023 11:57:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=BB=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- updatekiller.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/updatekiller.py b/updatekiller.py index 962aee4..d44b6b9 100755 --- a/updatekiller.py +++ b/updatekiller.py @@ -8,11 +8,15 @@ PIDFILE = '/tmp/uengine-runner.pid' #程序结束时清理pid @atexit.register def remove_pid(): - with open(PIDFILE) as pidfile: - pidlst = pidfile.readlines() - pidlst.remove(str(PID)+'\n') - with open(PIDFILE,'w') as pidfile: - pidfile.writelines(pidlst) + try: + with open(PIDFILE) as pidfile: + pidlst = pidfile.readlines() + pidlst.remove(str(PID)+'\n') + with open(PIDFILE,'w') as pidfile: + pidfile.writelines(pidlst) + except: + # 忽略 + pass #更新时结束进程 def main():