| 60 | } |
| 61 | |
| 62 | int RunProcessWide(const std::filesystem::path& application, |
| 63 | const std::wstring& arguments, |
| 64 | const std::filesystem::path& workingDirectory) { |
| 65 | STARTUPINFOW startupInfo = {}; |
| 66 | startupInfo.cb = sizeof(startupInfo); |
| 67 | PROCESS_INFORMATION processInfo = {}; |
| 68 | std::wstring commandLine = arguments; |
| 69 | if (!CreateProcessW(WideFromUtf8(application.u8string()).c_str(), |
| 70 | commandLine.data(), nullptr, nullptr, FALSE, 0, nullptr, |
| 71 | WideFromUtf8(workingDirectory.u8string()).c_str(), |
| 72 | &startupInfo, &processInfo)) { |
| 73 | return -1; |
| 74 | } |
| 75 | WaitForSingleObject(processInfo.hProcess, INFINITE); |
| 76 | DWORD exitCode = 1; |
| 77 | GetExitCodeProcess(processInfo.hProcess, &exitCode); |
| 78 | CloseHandle(processInfo.hThread); |
| 79 | CloseHandle(processInfo.hProcess); |
| 80 | return static_cast<int>(exitCode); |
| 81 | } |
| 82 | #endif |
| 83 | |
| 84 | #ifdef BAZEL |
no test coverage detected