mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Sporadically crashes on Windows when exit. Fixes #3177
1) Shutdown the python server properly. 2) Disabled "Shutdown server" menu till server is not successfully started. Initial patch sent by Maxim, modified by Akshay Joshi.
This commit is contained in:
committed by
Akshay Joshi
parent
3c4359270e
commit
54b1a79cb6
@@ -10,7 +10,7 @@
|
||||
"""A blueprint module providing utility functions for the application."""
|
||||
|
||||
import pgadmin.utils.driver as driver
|
||||
from flask import url_for, render_template, Response
|
||||
from flask import url_for, render_template, Response, request
|
||||
from flask_babel import gettext
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
@@ -116,3 +116,17 @@ def explain_js():
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
)
|
||||
|
||||
##########################################################################
|
||||
# A special URL used to shutdown the server
|
||||
##########################################################################
|
||||
@blueprint.route("/shutdown", methods=('get', 'post'))
|
||||
def shutdown():
|
||||
if config.SERVER_MODE is not True:
|
||||
func = request.environ.get('werkzeug.server.shutdown')
|
||||
if func is None:
|
||||
raise RuntimeError('Not running with the Werkzeug Server')
|
||||
func()
|
||||
return 'SHUTDOWN'
|
||||
else:
|
||||
return ''
|
||||
|
Reference in New Issue
Block a user