CdbExt: correctly escape python messages

Messages from python that contain a path like deprecation warnings
contain backslashes. These unescaped backslashes result in parse errors
on the creator side:
"MI Parse Error, unrecognized backslash escape"

Change-Id: Ic6eb6e1d95b18a653767a5b64030d755f6e8970a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-01-06 11:15:05 +01:00
parent 03cc67abd1
commit bb892e6427

View File

@@ -446,12 +446,10 @@ std::string collectOutput()
// Add a child to messages for every line. // Add a child to messages for every line.
while (std::getline(pyStdout, line)) { while (std::getline(pyStdout, line)) {
// there are two kinds of messages we want to handle here: // there are two kinds of messages we want to handle here:
if (line.find("bridgemessage=") == 0) { // preformatted gdmi bridgemessages from warn() if (line.find("bridgemessage=") == 0) // preformatted gdmi bridgemessages from warn()
ret << line << ','; ret << line << ',';
} else { // and a line of "normal" python output else // and a line of "normal" python output
replace(line, '"', '$'); // otherwise creators gdbmi parser would fail ret << "line=\"" << gdbmiStringFormat(line) << "\",";
ret << "line=\"" << line << "\",";
}
} }
ret << "]," << results << "]"; ret << "]," << results << "]";
results.clear(); results.clear();