Commit fcb933e6 authored by Stavros Sachtouris's avatar Stavros Sachtouris Committed by Giorgos Korfiatis
Browse files

Fix calling launch_server from CLI script

parent b1c5c138
...@@ -82,8 +82,7 @@ class GUI(WebSocketBaseClient): ...@@ -82,8 +82,7 @@ class GUI(WebSocketBaseClient):
def run(): def run():
"""Prepare SessionHelper and GUI and run them in the proper order""" """Prepare SessionHelper and GUI and run them in the proper order"""
LOG.info('Start SessionHelper session') LOG.info('Start SessionHelper session')
subprocess.Popen([ subprocess.Popen(['agkyra-cli', 'launch_server'])
os.path.join(CURPATH, 'scripts/cli.py'), 'launch_server'])
LOG.info('Client blocks until session is ready') LOG.info('Client blocks until session is ready')
session = SessionHelper().wait_session_to_load() session = SessionHelper().wait_session_to_load()
......
...@@ -147,7 +147,7 @@ class WebSocketProtocol(WebSocket): ...@@ -147,7 +147,7 @@ class WebSocketProtocol(WebSocket):
GUI: {"method": "post", "path": "pause"} GUI: {"method": "post", "path": "pause"}
HELPER: {"OK": 200, "action": "post pause"} or error HELPER: {"OK": 200, "action": "post pause"} or error
-- start -- -- START --
GUI: {"method": "post", "path": "start"} GUI: {"method": "post", "path": "start"}
HELPER: {"OK": 200, "action": "post start"} or error HELPER: {"OK": 200, "action": "post start"} or error
......
...@@ -40,18 +40,20 @@ LOGGER.setLevel(logging.DEBUG) ...@@ -40,18 +40,20 @@ LOGGER.setLevel(logging.DEBUG)
def main(): def main():
from agkyra.cli import AgkyraCLI from agkyra.cli import AgkyraCLI
from sys import argv from sys import argv
AgkyraCLI().onecmd(' '.join(argv[1:] or ['help', ]))
if __name__ == "__main__":
if sys.argv[1] in ('launch_server', ): if sys.argv[1] in ('launch_server', ):
# This piece of code will stay here until the CLI can launch a server # This piece of code will stay here until the CLI can launch a server
# by itself # by itself
from agkyra.protocol import SessionHelper from agkyra.protocol import SessionHelper
LOGGER.debug('Please start the session helper') LOGGER.debug('Start the session helper')
helper = SessionHelper() helper = SessionHelper()
if not helper.load_active_session(): if not helper.load_active_session():
helper.create_session() helper.create_session()
helper.server.serve_forever() helper.server.serve_forever()
else:
LOGGER.info('Another session is running, aborting')
else: else:
main() AgkyraCLI().onecmd(' '.join(argv[1:] or ['help', ]))
if __name__ == "__main__":
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment