Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-22 10:48:08 +0200
committerGitHub2019-09-22 10:48:08 +0200
commitda0062f7c18434c900da07dcf291581ae2cebfba (patch)
treec6f187f4b51abd4d3aeb34ef9fa4c21e32225484 /misc
parentaf84f1350e619c7c74257037c6869c8f031fcef3 (diff)
parentde42f8a93e2febf11bfac74067250e344be24adb (diff)
downloadcatch3-da0062f7c18434c900da07dcf291581ae2cebfba.tar.gz
Merge pull request #1752 from amitherman95/amitherman-1737
Escape characters bug patch(v2.9.2)
Diffstat (limited to 'misc')
-rw-r--r--misc/coverage-helper.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/misc/coverage-helper.cpp b/misc/coverage-helper.cpp
index b9558b75..a31e927f 100644
--- a/misc/coverage-helper.cpp
+++ b/misc/coverage-helper.cpp
@@ -29,7 +29,8 @@ std::string escape_arg(const std::string& arg) {
escaped.append(num_backslashes * 2, '\\');
break;
} else if (*it == '"') {
- escaped.append(num_backslashes * 2 + 1, '\\');
+ escaped.append((num_backslashes + 1) * 2, '\\');
+ escaped.push_back('"');
escaped.push_back(*it);
} else {
escaped.append(num_backslashes, '\\');
@@ -97,7 +98,7 @@ int exec_cmd(std::string const& cmd, int log_num, std::string const& path) {
+ ".bin --quiet " + "--sources " + escape_arg(path) + " --cover_children -- " + cmd;
std::cout << "=== Marker ===: Cmd: " << real_cmd << '\n';
auto pipe = _popen(real_cmd.c_str(), "r");
-
+
if (!pipe) {
throw std::runtime_error("popen() failed!");
}
@@ -106,12 +107,12 @@ int exec_cmd(std::string const& cmd, int log_num, std::string const& path) {
std::cout << buffer.data();
}
}
-
+
auto ret = _pclose(pipe);
if (ret == -1) {
throw std::runtime_error("underlying error in pclose()");
}
-
+
return ret;
}
@@ -127,7 +128,7 @@ int main(int argc, char** argv) {
assert(sep - begin(args) == 2 && "Structure differs from expected!");
auto num = parse_log_file_arg(args[1]);
-
+
auto cmdline = std::accumulate(++sep, end(args), std::string{}, [] (const std::string& lhs, const std::string& rhs) {
return lhs + ' ' + escape_arg(rhs);
});