Hi,
Right now I’ve subclassed ExecCommand and i want to extend the functionality of the on_finish method to fit my needs:
def finish(self, proc):
print('-'*80)
sublime.log_result_regex(True)
super().finish(proc)
sublime.log_result_regex(False)
print('-'*80)
exit_code = proc.exit_code()
errs = self.output_view.find_all_results()
print(errs)
print('-'*80)
if exit_code == 0 or exit_code is None:
... EXTRA STUFF DEPENDING OF ERRORS&WARNINGS ...
here’s the thing, I got at my disposal 2 sources of information, exit_code = proc.exit_code()
and errs = self.output_view.find_all_results()
, with those 2 variables theorically i can have a decent control of what happened with the process, but… i want more, I’d like to know which are exactly the errors and which are the warnings, right now my file_regex looks like this:
"file_regex": "^(?:\\.{2}\\\\)*([a-z]?:?[^\\(\n]+)\\(([^\\)]+)\\): ([^\n]+)"
But this one doesn’t distinguish between errors/warnings, it captures everything, let’s say i got this source file:
#include <stdio.h>
#pragma message ("this\\is\\a\\path(3): warning C666: i'm a random warning")
#pragma message ("this\\is\\a\\path(4): error C666: i'm a random error")
int main(int argc, char* argv[]) {
}
If I run it, the pasted subclassed on_finish pasted above would print:
--------------------------------------------------------------------------------
found result file, line, col of [this\is\a\path], [3], [warning C666: i'm a random warning] full path: /C/Users/KneDa/Desktop/st_forum_issue/this/is/a/path
found result file, line, col of [this\is\a\path], [4], [error C666: i'm a random error] full path: /C/Users/KneDa/Desktop/st_forum_issue/this/is/a/path
--------------------------------------------------------------------------------
[('/C/Users/KneDa/Desktop/st_forum_issue/this/is/a/path', 3, 0), ('/C/Users/KneDa/Desktop/st_forum_issue/this/is/a/path', 4, 0)]
--------------------------------------------------------------------------------
Which btw, it’s kind of strange… why do the errs
variable doesn’t contain the warning messages and the log_result_regex
it does O_o?
Anyway, question is, how can i capture and distinguish between errors/warnings?
warnings: "file_regex": "^(?:\\.{2}\\\\)*([a-z]?:?[^\\(\n]+)\\(([^\\)]+)\\): warning ([^\n]+)"
errors: "file_regex": "^(?:\\.{2}\\\\)*([a-z]?:?[^\\(\n]+)\\(([^\\)]+)\\): error ([^\n]+)"
of
Thanks in advance