mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-09 07:33:19 -06:00
Save the runtime status information in the application object for using
it other places. globals() does not return consistent value across the application context. Thanks Neel Patel for reporting the issue.
This commit is contained in:
parent
d133e33c4b
commit
a35288e25d
@ -72,6 +72,9 @@ else:
|
||||
config.DEFAULT_SERVER_PORT)
|
||||
server_port = config.DEFAULT_SERVER_PORT
|
||||
|
||||
# Let the application save the status about the runtime for using it later.
|
||||
app.PGADMIN_RUNTIME = PGADMIN_RUNTIME
|
||||
|
||||
# Output a startup message if we're not under the runtime
|
||||
if not PGADMIN_RUNTIME:
|
||||
print("Starting %s. Please navigate to http://localhost:%d in your browser." %
|
||||
|
@ -22,6 +22,7 @@ import pytz
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
|
||||
from flask import current_app as app
|
||||
from flask.ext.babel import gettext as _
|
||||
from flask.ext.security import current_user
|
||||
|
||||
@ -33,13 +34,6 @@ if sys.version_info < (3,):
|
||||
else:
|
||||
from io import StringIO
|
||||
|
||||
# The port number should have already been set by the runtime if we're running
|
||||
# in desktop mode.
|
||||
PGADMIN_RUNTIME = False
|
||||
|
||||
if 'PGADMIN_PORT' in globals():
|
||||
PGADMIN_RUNTIME = True
|
||||
|
||||
|
||||
def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
|
||||
"""
|
||||
@ -188,7 +182,7 @@ class BatchProcess(object):
|
||||
|
||||
p = None
|
||||
cmd = [
|
||||
(sys.executable if not PGADMIN_RUNTIME else
|
||||
(sys.executable if not app.PGADMIN_RUNTIME else
|
||||
'pythonw.exe' if os.name == 'nt' else 'python'),
|
||||
executor,
|
||||
'-p', self.id,
|
||||
|
Loading…
Reference in New Issue
Block a user