diff --git a/object_creator/creator_main.cpp b/object_creator/creator_main.cpp index dd85ab9472ee5..6b6235062a10b 100644 --- a/object_creator/creator_main.cpp +++ b/object_creator/creator_main.cpp @@ -23,6 +23,13 @@ #include #include +//Required by the sigaction function in the exit_handler +#if defined(_WIN32) +#include "platform_win.h" +#else +#include +#endif + #ifdef _WIN32 #include Q_IMPORT_PLUGIN( QWindowsIntegrationPlugin ); @@ -46,7 +53,20 @@ void exit_handler( int s ) catacurses::endwin(); - exit( exit_status ); + // As suggested by https://github.com/CleverRaven/Cataclysm-DDA/pull/67893 + #if !defined(_WIN32) + if( s == 2 ) { + struct sigaction sigIntHandler; + sigIntHandler.sa_handler = SIG_DFL; + sigemptyset( &sigIntHandler.sa_mask ); + sigIntHandler.sa_flags = 0; + sigaction( SIGINT, &sigIntHandler, nullptr ); + kill( getpid(), s ); + } else + #endif + { + exit( exit_status ); + } } inp_mngr.set_timeout( old_timeout ); }