From 622d5af1dfe794e25d3c389b71d77c92bd99710b Mon Sep 17 00:00:00 2001 From: TB-1993 <109213741+TB-1993@users.noreply.github.com> Date: Thu, 1 May 2025 15:56:04 +0000 Subject: [PATCH] Fix #164 - Fixed bug in StreamLogger's readUntil method Changed the readUntil method to increment one last time after finding the search string to prevent the same line being searched twice on consecutive calls. --- framework/core/streamToFile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/framework/core/streamToFile.py b/framework/core/streamToFile.py index f0df434..0f1840f 100644 --- a/framework/core/streamToFile.py +++ b/framework/core/streamToFile.py @@ -21,8 +21,6 @@ def writeStreamToFile(self, inputStream: IOBase) -> None: Args: inputStream (IOBase): The input stream to be read from. - outFileName (str): The path of the output file where the stream data will be written. - If only a file name is given, the file will be written in the current tests log directory. """ self._fileHandle = open(self._filePath, 'a+', encoding='utf-8') self._stopThread = False @@ -84,10 +82,9 @@ def readUntil(self, searchString:str, retries: int = 5) -> None: if read_line == write_line: time.sleep(1) else: - while read_line < write_line: + while read_line < write_line and len(result) == 0: if searchString in out_lines[read_line]: result = out_lines[:read_line] - break read_line+=1 retry += 1 self._readLine = read_line