aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukka <681992+lukka@users.noreply.github.com>2019-08-01 17:48:22 -0700
committerPhil Christensen <philc@microsoft.com>2019-08-01 17:48:22 -0700
commitae6ca87221cf71fc217bff65f0df0808da17a047 (patch)
tree5e6627afa3f3cc873eb15094391d15ce29cad420
parentfeeaa65cdc514fff6e2d363e09adfcc3f6fed13a (diff)
downloadvcpkg-ae6ca87221cf71fc217bff65f0df0808da17a047.tar.gz
vcpkg-ae6ca87221cf71fc217bff65f0df0808da17a047.zip
- 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.
-rw-r--r--toolsrc/src/vcpkg/base/files.cpp4
-rw-r--r--toolsrc/src/vcpkg/vcpkgcmdarguments.cpp2
2 files changed, 5 insertions, 1 deletions
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;