From 733f1b1eb14cb67b1e681eed4f34abd23c50db70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Fri, 13 Oct 2023 20:26:42 +0200 Subject: [PATCH] close pipes on RETAIL --- MAKE.bat | 6 +++--- engine/joint/v4k.h | 11 +++++++++-- engine/split/v4k_main.c | 11 +++++++++-- engine/v4k.c | 11 +++++++++-- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/MAKE.bat b/MAKE.bat index befd161..1672498 100644 --- a/MAKE.bat +++ b/MAKE.bat @@ -201,9 +201,9 @@ if "%1"=="push" ( call make.bat tidy git status - rem if not "%2"=="dp" ( - rem call MAKE.bat dpush auto - rem ) + if "%2"=="dp" ( + call MAKE.bat dpush auto + ) git add . git commit if not "%2"=="local" ( diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 8b36840..d238242 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -357036,7 +357036,14 @@ const struct in6_addr in6addr_any; // = IN6ADDR_ANY_INIT; //static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; #endif -// @fixme crashes right now -// ifdef(retail, AUTORUN { fclose(stderr); fclose(stdout); } ) +ifdef(retail, AUTORUN { + fclose(stderr); + fclose(stdout); + + const char* null_stream = ifdef(win32, "nul:", "/dev/null"); + + if (!freopen(null_stream, "a", stdout)) PANIC("cannot recreate standard streams"); + if (!freopen(null_stream, "a", stderr)) PANIC("cannot recreate standard streams"); +} ) #line 0 #endif // V4K_IMPLEMENTATION diff --git a/engine/split/v4k_main.c b/engine/split/v4k_main.c index 5ca26a6..1ed7ec1 100644 --- a/engine/split/v4k_main.c +++ b/engine/split/v4k_main.c @@ -126,5 +126,12 @@ const struct in6_addr in6addr_any; // = IN6ADDR_ANY_INIT; //static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; #endif -// @fixme crashes right now -// ifdef(retail, AUTORUN { fclose(stderr); fclose(stdout); } ) +ifdef(retail, AUTORUN { + fclose(stderr); + fclose(stdout); + + const char* null_stream = ifdef(win32, "nul:", "/dev/null"); + + if (!freopen(null_stream, "a", stdout)) PANIC("cannot recreate standard streams"); + if (!freopen(null_stream, "a", stderr)) PANIC("cannot recreate standard streams"); +} ) diff --git a/engine/v4k.c b/engine/v4k.c index 160f8d4..2fb0fe7 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -26051,6 +26051,13 @@ const struct in6_addr in6addr_any; // = IN6ADDR_ANY_INIT; //static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; #endif -// @fixme crashes right now -// ifdef(retail, AUTORUN { fclose(stderr); fclose(stdout); } ) +ifdef(retail, AUTORUN { + fclose(stderr); + fclose(stdout); + + const char* null_stream = ifdef(win32, "nul:", "/dev/null"); + + if (!freopen(null_stream, "a", stdout)) PANIC("cannot recreate standard streams"); + if (!freopen(null_stream, "a", stderr)) PANIC("cannot recreate standard streams"); +} ) #line 0