MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / RunProcessWide

Function RunProcessWide

plugins/jieba/tests/JiebaPluginIntegrationTest.cpp:62–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62int 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

Callers 1

TEST_FFunction · 0.85

Calls 2

WideFromUtf8Function · 0.70
dataMethod · 0.45

Tested by

no test coverage detected