MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / restart

Function restart

zeronet.py:89–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87 time.sleep(1) # Wait files to close
88
89def restart():
90 args = sys.argv[:]
91
92 sys.executable = sys.executable.replace(".pkg", "") # Frozen mac fix
93
94 if not getattr(sys, 'frozen', False):
95 args.insert(0, sys.executable)
96
97 # Don't open browser after restart
98 if "--open_browser" in args:
99 del args[args.index("--open_browser") + 1] # argument value
100 del args[args.index("--open_browser")] # argument key
101
102 if getattr(sys, 'frozen', False):
103 pos_first_arg = 1 # Only the executable
104 else:
105 pos_first_arg = 2 # Interpter, .py file path
106
107 args.insert(pos_first_arg, "--open_browser")
108 args.insert(pos_first_arg + 1, "False")
109
110 if sys.platform == 'win32':
111 args = ['"%s"' % arg for arg in args]
112
113 try:
114 print("Executing %s %s" % (sys.executable, args))
115 os.execv(sys.executable, args)
116 except Exception as err:
117 print("Execv error: %s" % err)
118 print("Bye.")
119
120
121def start():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected