#278: fix an exit via misc.restart.restart_application as graceful.

This commit is contained in:
Bill Dengler 2019-05-17 20:50:15 -04:00
parent d441536f01
commit 6311d541da
3 changed files with 5 additions and 2 deletions

View File

@ -656,7 +656,7 @@ class Controller(object):
sessions.sessions[item].shelve() sessions.sessions[item].shelve()
if system == "Windows": if system == "Windows":
self.systrayIcon.RemoveIcon() 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): if os.path.exists(pidpath):
os.remove(pidpath) os.remove(pidpath)
widgetUtils.exit_application() widgetUtils.exit_application()

View File

@ -113,7 +113,7 @@ def is_running(pid):
def check_pid(): def check_pid():
"Insures that only one copy of the application is running at a time." "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): if os.path.exists(pidpath):
with open(pidpath) as fin: with open(pidpath) as fin:
pid = int(fin.read()) pid = int(fin.read())

View File

@ -7,5 +7,8 @@ def restart_program():
if not hasattr(sys, "frozen"): if not hasattr(sys, "frozen"):
args.insert(0, sys.executable) args.insert(0, sys.executable)
if sys.platform == 'win32': 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] args = ['"%s"' % arg for arg in args]
os.execv(sys.executable, args) os.execv(sys.executable, args)