diff --git a/Sources/kong.c b/Sources/kong.c index 12f748d..49fe681 100644 --- a/Sources/kong.c +++ b/Sources/kong.c @@ -587,3 +587,23 @@ int main(int argc, char **argv) { return 0; } + +#ifdef _WIN32 +#include +#endif + +void execute_sync(const char* command) { +#ifdef _WIN32 + STARTUPINFOA startupInfo; + PROCESS_INFORMATION processInfo; + memset(&startupInfo, 0, sizeof(startupInfo)); + memset(&processInfo, 0, sizeof(processInfo)); + startupInfo.cb = sizeof(startupInfo); + CreateProcessA(nullptr, (char*)command, nullptr, nullptr, FALSE, CREATE_DEFAULT_ERROR_MODE, "PATH=%PATH%;.\\cygwin\\bin\0", nullptr, &startupInfo, &processInfo); + WaitForSingleObject(processInfo.hProcess, INFINITE); + CloseHandle(processInfo.hProcess); + CloseHandle(processInfo.hThread); +#else + system(command); +#endif +}