Skip to content

Commit 218898e

Browse files
Use CreateProcessW explicitly to improve compatibility (#160096)
We compile our monorepo with `/D_MBCS` and flang-rt compilation breaks as it explicitly uses `wchar_t` (i. e. not TCHAR). Use STARTUPINFOW / CreateProcessW method explicitly to make the code work disregarding global settings.
1 parent 4d78801 commit 218898e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

flang-rt/lib/runtime/execute.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void RTNAME(ExecuteCommandLine)(const Descriptor &command, bool wait,
212212
} else {
213213
// Asynchronous mode
214214
#ifdef _WIN32
215-
STARTUPINFO si;
215+
STARTUPINFOW si;
216216
PROCESS_INFORMATION pi;
217217
ZeroMemory(&si, sizeof(si));
218218
si.cb = sizeof(si);
@@ -234,7 +234,7 @@ void RTNAME(ExecuteCommandLine)(const Descriptor &command, bool wait,
234234
}
235235
FreeMemory(newCmdWin);
236236

237-
if (CreateProcess(nullptr, wcmd, nullptr, nullptr, FALSE, 0, nullptr,
237+
if (CreateProcessW(nullptr, wcmd, nullptr, nullptr, FALSE, 0, nullptr,
238238
nullptr, &si, &pi)) {
239239
// Close handles so it will be removed when terminated
240240
CloseHandle(pi.hProcess);

0 commit comments

Comments
 (0)