Skip to content

Commit 1c12cf6

Browse files
committed
Merge #13886: utils: run commands using utf-8 string on Windows
23db954 utils: run commands using utf-8 string on Windows (Chun Kuan Lee) Pull request description: Use unicode string to call commans Tree-SHA512: 72f84e7b56cd947ad05176f10b5ddd5610f4641ba5e93ffd67777dea8f9734ec06e6ed3a63f67ae5e766767122c0dd2c441d0bad5572bdb9fb78758f02531feb
2 parents 4103cc3 + 23db954 commit 1c12cf6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/util.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#ifndef NOMINMAX
5959
#define NOMINMAX
6060
#endif
61+
#include <codecvt>
6162

6263
#include <io.h> /* for _commit */
6364
#include <shlobj.h>
@@ -1154,7 +1155,11 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
11541155
void runCommand(const std::string& strCommand)
11551156
{
11561157
if (strCommand.empty()) return;
1158+
#ifndef WIN32
11571159
int nErr = ::system(strCommand.c_str());
1160+
#else
1161+
int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
1162+
#endif
11581163
if (nErr)
11591164
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
11601165
}

0 commit comments

Comments
 (0)