Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

#69 Fixing 0.3.0 expect match issue when channel receives multiple lines … #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vinaykumar-c
Copy link
Contributor

…of strings at the same time

@zebbarry
Copy link

I think that was originally changed because checking the entire output everytime caused it to time out? #63

@@ -188,7 +187,7 @@ def expect(

# Add the currently read buffer to the output
self.current_output += current_buffer_decoded
current_buffer_output_decoded = '\n' + self.current_output.splitlines()[-1]
current_buffer_output_decoded = '\n' + current_buffer_decoded

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the latest output for any matches instead of all the total output - Requires current_output_line = 0 to be initialized before the while loop

Suggested change
current_buffer_output_decoded = '\n' + current_buffer_decoded
# Add the currently read buffer to the output
self.current_output += current_buffer_decoded
output_lines = self.current_output.splitlines()
# Check the latest output for any matches
current_buffer_output_decoded = '\n' + '\n'.join(output_lines[current_output_line:])
# Update current line in output that has been checked
current_output_line += len(output_lines[current_output_line:]) - 1

@oskrdt
Copy link
Contributor

oskrdt commented Nov 13, 2024

I just hit the issue and realized that the code fix proposed by @vinaykumar-c as it is should work.
I don't see the need of the extra logic provided by @zebbarry.
Could we merge it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants