Skip to content

Commit

Permalink
Merge pull request #2514 from barton2526/utf-8-Windows
Browse files Browse the repository at this point in the history
utils: run commands using utf-8 string on Windows
  • Loading branch information
jamescowens committed May 18, 2022
2 parents 4debd00 + 0424fa3 commit c55b616
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <boost/iostreams/filter/newline.hpp>
#include <openssl/crypto.h>
#include <cstdarg>
#include <codecvt>

using namespace std;

Expand Down Expand Up @@ -382,7 +383,11 @@ std::vector<std::string> split(const std::string& s, const std::string& delim)

void runCommand(std::string strCommand)
{
#ifndef WIN32
int nErr = ::system(strCommand.c_str());
#else
int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
#endif
if (nErr)
LogPrintf("runCommand error: system(%s) returned %d", strCommand, nErr);
}
Expand Down

0 comments on commit c55b616

Please sign in to comment.