macOS restart support

This commit is contained in:
shortcutme 2017-01-21 23:01:29 +01:00
parent e7d8f6b807
commit 8f3c596d46
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 13 additions and 2 deletions

View File

@ -63,11 +63,22 @@ def main():
import time
time.sleep(1) # Wait files to close
args = sys.argv[:]
args.insert(0, sys.executable)
sys.executable = sys.executable.replace(".pkg", "") # Frozen mac fix
if not getattr(sys, 'frozen', False):
args.insert(0, sys.executable)
if sys.platform == 'win32':
args = ['"%s"' % arg for arg in args]
os.execv(sys.executable, args)
try:
print "Executing %s %s" % (sys.executable, args)
os.execv(sys.executable, args)
except Exception, err:
print "Execv error: %s" % err
print "Bye."
if __name__ == '__main__':
main()