aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg_System.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-25 23:34:44 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-25 23:34:44 -0700
commit581aea74fb9737ee1efb0ae5d662ede8268b8e49 (patch)
tree6d171a01d29cfe8d60e13ab7c5ed1f00b4d41f0d /toolsrc/src/vcpkg_System.cpp
parent7a2a237e13da457bc672e27c03c492e128bdd11d (diff)
downloadvcpkg-581aea74fb9737ee1efb0ae5d662ede8268b8e49.tar.gz
vcpkg-581aea74fb9737ee1efb0ae5d662ede8268b8e49.zip
[vcpkg] Use fgetws instead of fgets to accomodate non-ascii results
Diffstat (limited to 'toolsrc/src/vcpkg_System.cpp')
-rw-r--r--toolsrc/src/vcpkg_System.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp
index 2d6246d19..140f7d1b0 100644
--- a/toolsrc/src/vcpkg_System.cpp
+++ b/toolsrc/src/vcpkg_System.cpp
@@ -170,24 +170,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)