-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parser stopped to read input after empty line #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,14 +156,18 @@ def _parse_log(self): | |
True) | ||
|
||
# While there is a new line, parse it. | ||
line = True # For the first condition. | ||
while line: | ||
line = "" | ||
while line is not None: | ||
# If the line contains non-UTF8 chars it could raise an exception. | ||
self.state['input_line'] += 1 | ||
line = device.read_line().rstrip("\r\n") | ||
line = device.read_line() | ||
|
||
# If EOF or the line is empty, continue. | ||
if not line or line == "": | ||
# Remove end of lines | ||
if line: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You first check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because we want to remove new line chars only when |
||
line = line.rstrip("\r\n") | ||
|
||
# Skip if EOF or empty line | ||
if not line: | ||
continue | ||
|
||
# Write original log if needed | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It should be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because then
line == ""
will be false too and don't want to stop for empty lines.