From 1d688c3417465014494ecfbe387598c889df63f4 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 14 Feb 2023 03:39:51 -0800 Subject: [PATCH] sdl/i_system.c: add -nofork option to disable forking signal handler --- src/sdl/i_system.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 515dc3e95..352313071 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1700,7 +1700,10 @@ INT32 I_StartupSystem(void) #endif I_StartupConsole(); #ifdef NEWSIGNALHANDLER - I_Fork(); + // This is useful when debugging. It lets GDB attach to + // the correct process easily. + if (!M_CheckParm("-nofork")) + I_Fork(); #endif I_RegisterSignals(); I_OutputMsg("Compiled for SDL version: %d.%d.%d\n", @@ -1993,9 +1996,10 @@ void I_ShutdownSystem(void) { INT32 c; -#ifndef NEWSIGNALHANDLER - I_ShutdownConsole(); +#ifdef NEWSIGNALHANDLER + if (M_CheckParm("-nofork")) #endif + I_ShutdownConsole(); for (c = MAX_QUIT_FUNCS-1; c >= 0; c--) if (quit_funcs[c])