def _restart_with_reloader(self):
while True:
args = [sys.executable] + sys.argv
if sys.platform == "win32":
args = ['"%s"' % arg for arg in args]
new_environ = os.environ.copy()
new_environ["RUN_MAIN"] = "true"
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
if exit_code != 3:
if exit_code != 0:
yn = raw_input('Server terminated abnormally, restart? [Yn]')
if not yn or yn.upper() == 'Y':
continue
return exit_code
评论列表
文章目录