diff options
-rw-r--r-- | bbot/worker/worker.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index f25a287..eb2609d 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -16,6 +16,7 @@ #include <libbutl/b.mxx> #include <libbutl/pager.mxx> +#include <libbutl/utility.mxx> // to_utf8() #include <libbutl/filesystem.mxx> #include <libbutl/string-parser.mxx> @@ -138,14 +139,11 @@ run_cmd (tracer& t, result_status r (result_status::success); - // Log the diagnostics. Also print it to stderr at verbosity level 3 or - // higher. + // UTF-8-sanitize and log the diagnostics. Also print the raw diagnostics + // to stderr at verbosity level 3 or higher. // - auto add = [&log, &t] (const string& s, bool trace = true) + auto add = [&log, &t] (string&& s, bool trace = true) { - log += s; - log += '\n'; - if (verb >= 3) { if (trace) @@ -153,6 +151,11 @@ run_cmd (tracer& t, else text << s; } + + to_utf8 (s, '?'); + + log += s; + log += '\n'; }; { @@ -161,7 +164,6 @@ run_cmd (tracer& t, for (string l; is.peek () != ifdstream::traits_type::eof (); ) { getline (is, l); - add (l, false); // Match the log line with the warning-detecting regular expressions // until the first match. @@ -183,6 +185,8 @@ run_cmd (tracer& t, } } } + + add (move (l), false /* trace */); } } |