From 93bd91f18b016990931cf879b2d9dd6e864f28ec Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Thu, 6 Jun 2024 13:58:11 +0200 Subject: [build] debug --- build.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'build.c') diff --git a/build.c b/build.c index c8f94e8..838d3ec 100755 --- a/build.c +++ b/build.c @@ -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; } -- cgit v1.2.3