Don't start the desktop app if another instance is already running.

master
Pacman Ghost 6 years ago
parent 4f62c8111f
commit c497c97721
  1. 11
      vasl_templates/main.py

@ -86,8 +86,17 @@ def main( template_pack, default_scenario, remote_debugging, debug ): #pylint: d
import flask.cli
flask.cli.show_server_banner = lambda *args: None
# start the webapp server
# see if we can connect to the webapp server
port = webapp.config["FLASK_PORT_NO"]
url = "http://localhost:{}/ping".format( port )
try:
resp = urllib.request.urlopen( url ).read()
except: #pylint: disable=bare-except
resp = None
if resp:
raise RuntimeError( "The application is already running." )
# start the webapp server
def webapp_thread():
"""Run the webapp server."""
try:

Loading…
Cancel
Save