diff --git a/exegol/config/ConstantConfig.py b/exegol/config/ConstantConfig.py index f6516f56..e2f96045 100644 --- a/exegol/config/ConstantConfig.py +++ b/exegol/config/ConstantConfig.py @@ -5,7 +5,7 @@ class ConstantConfig: """Constant parameters information""" # Exegol Version - version: str = "4.3.9" + version: str = "4.3.10b1" # Exegol documentation link documentation: str = "https://exegol.rtfd.io/" diff --git a/exegol/model/ContainerConfig.py b/exegol/model/ContainerConfig.py index 03bdd87a..388ef249 100644 --- a/exegol/model/ContainerConfig.py +++ b/exegol/model/ContainerConfig.py @@ -101,8 +101,8 @@ def __init__(self, container: Optional[Container] = None): self.__labels: Dict[str, str] = {} self.__ports: Dict[str, Optional[Union[int, Tuple[str, int], List[int], List[Dict[str, Union[int, str]]]]]] = {} self.__extra_host: Dict[str, str] = {} - self.interactive: bool = True - self.tty: bool = True + self.interactive: bool = False + self.tty: bool = False self.shm_size: str = self.__default_shm_size self.__workspace_custom_path: Optional[str] = None self.__workspace_dedicated_path: Optional[str] = None diff --git a/exegol/utils/ContainerLogStream.py b/exegol/utils/ContainerLogStream.py index f5dc6b30..50201f07 100644 --- a/exegol/utils/ContainerLogStream.py +++ b/exegol/utils/ContainerLogStream.py @@ -43,14 +43,15 @@ def __next__(self): assert self.__data_stream is not None # Parsed the data stream to extract characters and merge them into a line. for streamed_char in self.__data_stream: + self.__enable_timeout = False # disable timeout if the container is up-to-date and support console logging + # Add new char to the buffer + Unify \r\n to \n + self.__line_buffer += streamed_char.replace(b'\r\n', b'\n') # When detecting an end of line, the buffer is returned as a single line. - if (streamed_char == b'\r' or streamed_char == b'\n') and len(self.__line_buffer) > 0: - line = self.__line_buffer.decode('utf-8').strip() - self.__line_buffer = b"" - return line - else: - self.__enable_timeout = False # disable timeout if the container is up-to-date and support console logging - self.__line_buffer += streamed_char # add characters to the line buffer + if b'\n' in self.__line_buffer: + lines = self.__line_buffer.split(b'\n') + self.__line_buffer = b'\n'.join(lines[1:]) if len(lines) > 1 else b'' + if len(lines[0]) > 0: + return lines[0].decode('utf-8').strip() # When the data stream is empty, check if a timeout condition apply if self.__enable_timeout and self.__until_date >= self.__timeout_date: logger.debug("Container log stream timed-out") @@ -64,5 +65,5 @@ def __next__(self): # Prepare the next iteration to fetch next logs self.__data_stream = None self.__since_date = self.__until_date - time.sleep(0.5) # Wait for more logs + time.sleep(1) # Wait for more logs self.__until_date = datetime.now() diff --git a/exegol/utils/imgsync/entrypoint.sh b/exegol/utils/imgsync/entrypoint.sh index cc700c38..8c1fe409 100755 --- a/exegol/utils/imgsync/entrypoint.sh +++ b/exegol/utils/imgsync/entrypoint.sh @@ -34,7 +34,8 @@ function endless() { # Entrypoint for the container, in order to have a process hanging, to keep the container alive # Alternative to running bash/zsh/whatever as entrypoint, which is longer to start and to stop and to very clean # shellcheck disable=SC2162 - read -u 2 # read from stderr => endlessly wait effortlessly + mkfifo -m 000 /tmp/.entrypoint # Create an empty fifo for sleep by read. + read <> /tmp/.entrypoint # read from /tmp/.entrypoint => endlessly wait without sub-process or need for TTY option } function shutdown() {