From 6311d541da7cbd925f6b500c0d5a55df311c7a69 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Fri, 17 May 2019 20:50:15 -0400 Subject: [PATCH] #278: fix an exit via `misc.restart.restart_application` as graceful. --- src/controller/mainController.py | 2 +- src/main.py | 2 +- src/mysc/restart.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 4f89c987..cdbdf709 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -656,7 +656,7 @@ class Controller(object): sessions.sessions[item].shelve() if system == "Windows": self.systrayIcon.RemoveIcon() - pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name)) + pidpath = os.path.join(os.getenv("temp"), "client.pid") if os.path.exists(pidpath): os.remove(pidpath) widgetUtils.exit_application() diff --git a/src/main.py b/src/main.py index 85cd97f4..8a3ddcea 100644 --- a/src/main.py +++ b/src/main.py @@ -113,7 +113,7 @@ def is_running(pid): def check_pid(): "Insures that only one copy of the application is running at a time." - pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name)) + pidpath = os.path.join(os.getenv("temp"), "client.pid") if os.path.exists(pidpath): with open(pidpath) as fin: pid = int(fin.read()) diff --git a/src/mysc/restart.py b/src/mysc/restart.py index c6db1e11..e5207c0c 100644 --- a/src/mysc/restart.py +++ b/src/mysc/restart.py @@ -7,5 +7,8 @@ def restart_program(): if not hasattr(sys, "frozen"): args.insert(0, sys.executable) if sys.platform == 'win32': + pidpath = os.path.join(os.getenv("temp"), "client.pid") + if os.path.exists(pidpath): + os.remove(pidpath) args = ['"%s"' % arg for arg in args] os.execv(sys.executable, args) \ No newline at end of file