@@ -103,33 +103,37 @@ def make_patches_from_log_file(log_file_lines) -> List[Patch]:
103103 line = parse_log_line (raw_line )
104104
105105 if line == "--- expected" :
106- while True :
107- next_line = parse_log_line (next (lines ))
108- if next_line == "+++ actual" :
109- break
106+ try :
107+ while True :
108+ next_line = parse_log_line (next (lines ))
109+ if next_line == "+++ actual" :
110+ break
110111
111- lines_changed = []
112+ lines_changed = []
112113
113- while True :
114- next_line = parse_log_line (next (lines ))
115- # it can be the case that
116- if next_line and next_line [0 ] in (" " , "-" , "+" , "@" ):
117- lines_changed .append (next_line )
118- if "FAILED" in next_line :
119- break
114+ while True :
115+ next_line = parse_log_line (next (lines ))
116+ # it can be the case that
117+ if next_line and next_line [0 ] in (" " , "-" , "+" , "@" ):
118+ lines_changed .append (next_line )
119+ if "FAILED" in next_line :
120+ break
120121
121- # error line _should_ be next, but sometimes the output gets interleaved...
122- # so we just skip until we find the error line
123- error_line = next_line
124- while True :
125- # internal
126- filename_match = re .fullmatch (r"^##\[error\].*FAILED\(RESULT\) (.*)$" , error_line )
127- if not filename_match :
128- # codeql action
129- filename_match = re .fullmatch (r"^.*FAILED\(RESULT\) (.*)$" , error_line )
130- if filename_match :
131- break
132- error_line = parse_log_line (next (lines ))
122+ # error line _should_ be next, but sometimes the output gets interleaved...
123+ # so we just skip until we find the error line
124+ error_line = next_line
125+ while True :
126+ # internal
127+ filename_match = re .fullmatch (r"^##\[error\].*FAILED\(RESULT\) (.*)$" , error_line )
128+ if not filename_match :
129+ # codeql action
130+ filename_match = re .fullmatch (r"^.*FAILED\(RESULT\) (.*)$" , error_line )
131+ if filename_match :
132+ break
133+ error_line = parse_log_line (next (lines ))
134+ except StopIteration :
135+ LOGGER .warning ("Encountered unexpected end of logs while parsing failure block." )
136+ break
133137
134138 full_path = filename_match .group (1 )
135139
0 commit comments