diff options
-rwxr-xr-x | build.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -562,11 +562,31 @@ i32 main(i32 argc, c8 **argv) { system(fmt("\"." DLM "%s" DLM "test_interprocess\" clean", destination)); +#if defined(_WIN32) && !defined(__CYGWIN__) + STARTUPINFO si = { .cb = sizeof(STARTUPINFO) }; + PROCESS_INFORMATION pi = { 0 }; +#endif + if (OS == WINDOWS) { - system(fmt("start "" \"." DLM "%s" DLM "test_interprocess\" reader", destination)); +#if defined(_WIN32) && !defined(__CYGWIN__) + printf(" *** Starting reader\n"); fflush(stdout); + CreateProcessA( + NULL, + fmt("\"." DLM "%s" DLM "test_interprocess\" reader", destination), + NULL, + NULL, + 0, + 0, + NULL, + NULL, + &si, + &pi + ); +#endif } else system(fmt("\"." DLM "%s" DLM "test_interprocess\" reader &", destination)); + printf(" *** Starting writer\n"); fflush(stdout); code = system(fmt("\"." DLM "%s" DLM "test_interprocess\" writer", destination)); if (code == 0) @@ -577,6 +597,14 @@ i32 main(i32 argc, c8 **argv) { } fflush(stdout); + printf(" *** Waiting for reader\n"); fflush(stdout); + +#if defined(_WIN32) && !defined(__CYGWIN__) + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + #endif + printf("\nAll done.\n"); return status; } |