Skip to content
This repository
Browse code

Show remaining unparsable stderr below parsed errors

  • Loading branch information...
commit d4fcf6264419e88af85b209e600c5e69b441d3af 1 parent 8b4aca9
Niklas Hambüchen authored January 13, 2013

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. 12  parseoutput.py
12  parseoutput.py
@@ -10,9 +10,10 @@
10 10
 
11 11
 # This regex matches an unindented line, followed by zero or more
12 12
 # indented, non-empty lines.
  13
+# It also eats whitespace before the first line.
13 14
 # The first line is divided into a filename, a line number, and a column.
14 15
 output_regex = re.compile(
15  
-    r'^(\S*):(\d+):(\d+):(.*$(?:\n^[ \t].*$)*)',
  16
+    r'\s*^(\S*):(\d+):(\d+):(.*$(?:\n^[ \t].*$)*)',
16 17
     re.MULTILINE)
17 18
 
18 19
 # Extract the filename, line, column, and description from an error message:
@@ -126,7 +127,14 @@ def parse_output_messages_and_show(view, msg, base_dir, exit_code, stderr):
126 127
 
127 128
     # The process has terminated; parse and display the output:
128 129
     parsed_messages = parse_output_messages(base_dir, stderr)
129  
-    output_text = format_output_messages(parsed_messages) if parsed_messages else stderr
  130
+    # The unparseable part (for other errors)
  131
+    unparsable = output_regex.sub('', stderr).strip()
  132
+    # If we couldn't parse any messages, just show the stderr
  133
+    # Otherwise the parsed errors and the unparsable stderr remainder
  134
+    unparsable_section_header = "\n\nREMAINING STDERR:\n\n"
  135
+    output_text = (format_output_messages(parsed_messages) +
  136
+                   unparsable_section_header + unparsable
  137
+                   if parsed_messages else stderr)
130 138
 
131 139
     show_output_result_text(view, msg, output_text, exit_code, base_dir)
132 140
 

0 notes on commit d4fcf62

Please sign in to comment.
Something went wrong with that request. Please try again.