Fix the Build Log Excerpt Macro Start/End Order #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current version of the code has an issue when the
end
pattern ismatched before the
start
pattern was found - it simply stops parsingthe log file. This is an issue in case the
end
pattern appears in thelog multiple times (including before the
start
pattern), e.g.If I use the following macro:
then the current version of the code prints an empty excerpt, since it
stops evaluating the log when it finds the first occurence of
sleep 5
.This feels strange, and caused me a couple of lost hours, since I was
trying to figure out why it didn't print anything. Looking at the code,
I found this issue, and have made a small change that ensures that the
end
pattern is only checked once thestart
pattern has been found.I hope this is fine, but to me it makes a lot more sense like that. I've
also added a unit test to verify that the fix works.