aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-29 18:58:01 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-29 18:58:01 -0700
commite0a9cae9283b78f4470479d0001ea058cc655789 (patch)
treef7feb7029312e195da3748ce6bed1516ffd17134 /toolsrc/src
parent526b1436a16b5c60760cbfc16a7f64e49cf13a01 (diff)
parent5b42ec9b5d7277d9a4452c4c3a109770d9437205 (diff)
downloadvcpkg-e0a9cae9283b78f4470479d0001ea058cc655789.tar.gz
vcpkg-e0a9cae9283b78f4470479d0001ea058cc655789.zip
Merge branch 'utf-1702'
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/VcpkgPaths.cpp9
-rw-r--r--toolsrc/src/vcpkg_System.cpp14
2 files changed, 15 insertions, 8 deletions
diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp
index 1a8693efc..1fe92014c 100644
--- a/toolsrc/src/VcpkgPaths.cpp
+++ b/toolsrc/src/VcpkgPaths.cpp
@@ -264,7 +264,14 @@ namespace vcpkg
const std::wstring cmd = System::create_powershell_script_cmd(script);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances");
- return Strings::split(ec_data.output, "\n");
+ return Util::fmap(Strings::split(ec_data.output, "\n"), [](const std::string& line) {
+ auto colon_pos = line.find(':');
+ if (colon_pos != std::string::npos && colon_pos > 0)
+ {
+ return line.substr(colon_pos - 1);
+ }
+ return line;
+ });
}
static Optional<fs::path> get_VS2015_installation_instance()
diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp
index c48f719e1..db4dfec9b 100644
--- a/toolsrc/src/vcpkg_System.cpp
+++ b/toolsrc/src/vcpkg_System.cpp
@@ -184,24 +184,24 @@ namespace vcpkg::System
const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s 2>&1")###", cmd_line);
Debug::println("_wpopen(%s)", Strings::to_utf8(actual_cmd_line));
- std::string output;
- char buf[1024];
+ std::wstring output;
+ wchar_t buf[1024];
auto pipe = _wpopen(actual_cmd_line.c_str(), L"r");
if (pipe == nullptr)
{
- return {1, output};
+ return {1, Strings::to_utf8(output)};
}
- while (fgets(buf, 1024, pipe))
+ while (fgetws(buf, 1024, pipe))
{
output.append(buf);
}
if (!feof(pipe))
{
- return {1, output};
+ return {1, Strings::to_utf8(output)};
}
auto ec = _pclose(pipe);
- Debug::println("_wpopen() returned %d", ec);
- return {ec, output};
+ Debug::println("_pclose() returned %d", ec);
+ return {ec, Strings::to_utf8(output)};
}
std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args)