2021.4.1 #11
@ -23,7 +23,7 @@ class LiveServerService(ServiceABC, FileSystemEventHandler):
|
|||||||
self._build_settings = build_settings
|
self._build_settings = build_settings
|
||||||
|
|
||||||
self._src_dir = os.path.join(self._runtime.working_directory, self._build_settings.source_path)
|
self._src_dir = os.path.join(self._runtime.working_directory, self._build_settings.source_path)
|
||||||
self._live_server = LiveServerThread(self._src_dir)
|
self._ls_thread = LiveServerThread(self._src_dir)
|
||||||
self._observer = None
|
self._observer = None
|
||||||
|
|
||||||
def _start_observer(self):
|
def _start_observer(self):
|
||||||
@ -34,15 +34,15 @@ class LiveServerService(ServiceABC, FileSystemEventHandler):
|
|||||||
def _restart(self):
|
def _restart(self):
|
||||||
for proc in psutil.process_iter():
|
for proc in psutil.process_iter():
|
||||||
with suppress(Exception):
|
with suppress(Exception):
|
||||||
if proc.cmdline() == self._live_server.command:
|
if proc.cmdline() == self._ls_thread.command:
|
||||||
os.system(f'pkill -f {self._live_server.main}')
|
os.system(f'pkill -f {self._ls_thread.main}')
|
||||||
|
|
||||||
Console.write_line('Restart\n')
|
Console.write_line('Restart\n')
|
||||||
while self._live_server.is_alive():
|
while self._ls_thread.is_alive():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
self._live_server = LiveServerThread(self._src_dir)
|
self._ls_thread = LiveServerThread(self._src_dir)
|
||||||
self._live_server.start()
|
self._ls_thread.start()
|
||||||
|
|
||||||
self._start_observer()
|
self._start_observer()
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class LiveServerService(ServiceABC, FileSystemEventHandler):
|
|||||||
def start(self):
|
def start(self):
|
||||||
Console.write_line('** CPL live development server is running **')
|
Console.write_line('** CPL live development server is running **')
|
||||||
self._start_observer()
|
self._start_observer()
|
||||||
self._live_server.start()
|
self._ls_thread.start()
|
||||||
|
|
||||||
Console.close()
|
Console.close()
|
||||||
Console.write('\n')
|
Console.write('\n')
|
||||||
|
@ -2,6 +2,7 @@ import time
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.application.application_abc import ApplicationABC
|
from cpl.application.application_abc import ApplicationABC
|
||||||
|
from cpl.console import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
from cpl.logging.logger_abc import LoggerABC
|
from cpl.logging.logger_abc import LoggerABC
|
||||||
from cpl.mailing.email import EMail
|
from cpl.mailing.email import EMail
|
||||||
@ -47,6 +48,6 @@ class Application(ApplicationABC):
|
|||||||
self._logger.debug(__name__, f'Host: {self._configuration.environment.host_name}')
|
self._logger.debug(__name__, f'Host: {self._configuration.environment.host_name}')
|
||||||
self._logger.debug(__name__, f'Environment: {self._configuration.environment.environment_name}')
|
self._logger.debug(__name__, f'Environment: {self._configuration.environment.environment_name}')
|
||||||
self._logger.debug(__name__, f'Customer: {self._configuration.environment.customer}')
|
self._logger.debug(__name__, f'Customer: {self._configuration.environment.customer}')
|
||||||
Console.spinner('Test', self._wait, 999999, spinner_foreground_color='red')
|
Console.spinner('Test', self._wait, 20, spinner_foreground_color='red')
|
||||||
# self.test_send_mail()
|
# self.test_send_mail()
|
||||||
# self.test_console()
|
# self.test_console()
|
||||||
|
Loading…
Reference in New Issue
Block a user