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):
def run():
"""Prepare SessionHelper and GUI and run them in the proper order"""
LOG.info('Start SessionHelper session')
subprocess.Popen([
os.path.join(CURPATH, 'scripts/cli.py'), 'launch_server'])
subprocess.Popen(['agkyra-cli', 'launch_server'])
LOG.info('Client blocks until session is ready')
session = SessionHelper().wait_session_to_load()
......
......@@ -147,7 +147,7 @@ class WebSocketProtocol(WebSocket):
GUI: {"method": "post", "path": "pause"}
HELPER: {"OK": 200, "action": "post pause"} or error
-- start --
-- START --
GUI: {"method": "post", "path": "start"}
HELPER: {"OK": 200, "action": "post start"} or error
......
......@@ -40,18 +40,20 @@ LOGGER.setLevel(logging.DEBUG)
def main():
from agkyra.cli import AgkyraCLI
from sys import argv
AgkyraCLI().onecmd(' '.join(argv[1:] or ['help', ]))
if __name__ == "__main__":
if sys.argv[1] in ('launch_server', ):
# This piece of code will stay here until the CLI can launch a server
# by itself
from agkyra.protocol import SessionHelper
LOGGER.debug('Please start the session helper')
LOGGER.debug('Start the session helper')
helper = SessionHelper()
if not helper.load_active_session():
helper.create_session()
helper.server.serve_forever()
else:
LOGGER.info('Another session is running, aborting')
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