mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2026-04-07 08:00:18 +08:00
This commit is contained in:
@@ -3,14 +3,15 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
PIDFILE = '/tmp/deepin-wine-runner.pid'
|
PIDFILE = '/tmp/uengine-runner.pid'
|
||||||
|
|
||||||
#程序结束时清理pid
|
#程序结束时清理pid
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def remove_pid():
|
def remove_pid():
|
||||||
|
'''程序结束时清理pid'''
|
||||||
with open(PIDFILE) as pidfile:
|
with open(PIDFILE) as pidfile:
|
||||||
pidlst = pidfile.readlines()
|
pidlst = pidfile.readlines()
|
||||||
pidlst.remove(str(PID)+'\n')
|
pidlst.remove(str(PID)+'\n') #移除记录中的pid
|
||||||
with open(PIDFILE,'w') as pidfile:
|
with open(PIDFILE,'w') as pidfile:
|
||||||
pidfile.writelines(pidlst)
|
pidfile.writelines(pidlst)
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ def main():
|
|||||||
os.kill(int(i),15)
|
os.kill(int(i),15)
|
||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
pass
|
pass
|
||||||
os.remove(PIDFILE)
|
## os.remove(PIDFILE) #因修复#I6ZRZX而注释
|
||||||
|
|
||||||
#当该程序被直接执行时,执行结束进程操作。如果是导入的形式,则只是记录pid
|
#当该程序被直接执行时,执行结束进程操作。如果是导入的形式,则只是记录pid
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user