Improved workspace handling in start command

This commit is contained in:
2021-04-08 19:30:00 +02:00
parent 806888bf49
commit 5f668e17c9
11 changed files with 68 additions and 50 deletions

View File

@@ -9,20 +9,24 @@ from watchdog.observers import Observer
from cpl.console.console import Console
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
from cpl_cli.configuration.build_settings import BuildSettings
from cpl_cli.configuration.project_settings import ProjectSettings
from cpl_cli.live_server.live_server_thread import LiveServerThread
class LiveServerService(FileSystemEventHandler):
def __init__(self, env: ApplicationEnvironmentABC, build_settings: BuildSettings):
def __init__(self, env: ApplicationEnvironmentABC, project_settings: ProjectSettings,
build_settings: BuildSettings):
"""
Service for the live development server
:param env:
:param project_settings:
:param build_settings:
"""
FileSystemEventHandler.__init__(self)
self._env = env
self._project_settings = project_settings
self._build_settings = build_settings
self._src_dir = os.path.join(self._env.working_directory, self._build_settings.source_path)
@@ -72,7 +76,13 @@ class LiveServerService(FileSystemEventHandler):
def _start(self):
self._start_observer()
self._ls_thread = LiveServerThread(self._src_dir, self._build_settings, self._args)
self._ls_thread = LiveServerThread(
self._project_settings.python_executable,
self._src_dir,
self._args,
self._env,
self._build_settings
)
self._ls_thread.start()
self._ls_thread.join()
Console.close()