mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Restart TWBlue gracefully
This commit is contained in:
parent
6bc63d79ff
commit
084fa1894c
@ -1,6 +1,7 @@
|
||||
# -*- coding: cp1252
|
||||
from __future__ import unicode_literals
|
||||
import sys, os
|
||||
import application
|
||||
|
||||
def restart_program():
|
||||
""" Function that restarts the application if is executed."""
|
||||
@ -9,4 +10,7 @@ def restart_program():
|
||||
args.insert(0, sys.executable)
|
||||
if sys.platform == 'win32':
|
||||
args = ['"%s"' % arg for arg in args]
|
||||
pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name))
|
||||
if os.path.exists(pidpath):
|
||||
os.remove(pidpath)
|
||||
os.execv(sys.executable, args)
|
Loading…
Reference in New Issue
Block a user