From ae6ca87221cf71fc217bff65f0df0808da17a047 Mon Sep 17 00:00:00 2001 From: lukka <681992+lukka@users.noreply.github.com> Date: Thu, 1 Aug 2019 17:48:22 -0700 Subject: - remove trailing \r when parsing response file that might have Windows line endings; (#7491) - when an option is not recognized (perhaps because it has trailing whitespace characters), print it out enclosed with single quote to delimit and highlight potenatial not printable characters. --- toolsrc/src/vcpkg/base/files.cpp | 4 ++++ toolsrc/src/vcpkg/vcpkgcmdarguments.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 4a5d3caf1..4446042f1 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -202,6 +202,10 @@ namespace vcpkg::Files std::string line; while (std::getline(file_stream, line)) { + // Remove the trailing \r to accomodate Windows line endings. + if ((!line.empty()) && (line.back() == '\r')) + line.pop_back(); + output.push_back(line); } file_stream.close(); diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index 7a28fb571..452c7ca19 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -389,7 +389,7 @@ namespace vcpkg System::printf(System::Color::error, "Unknown option(s) for command '%s':\n", this->command); for (auto&& option : options_copy) { - System::print2(" ", option.first, "\n"); + System::print2(" '", option.first, "'\n"); } System::print2("\n"); failed = true; -- cgit v1.2.3