upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/process.cpp
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:09:37 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:09:37 -0500
commit7aba4a441192e35655b4b0629b74c6cfe5476292 (patch)
treedbc626444a2bfd7e975a96fb05ae91c85536d0bc /runtime/shims/process.cpp
parent27c055f7a1abd2c0a2fb92b6d1cde4960e0d3983 (diff)
parentb2e888f52e33e4f64c46701778ccda06aff6fc40 (diff)
Merge pull request #3928 from sds-228
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/process.cpp')
-rw-r--r--runtime/shims/process.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp
index 0bca28443..11464111e 100644
--- a/runtime/shims/process.cpp
+++ b/runtime/shims/process.cpp
@@ -22,6 +22,7 @@
22#include <windows.h> 22#include <windows.h>
23 23
24#include <atomic> 24#include <atomic>
25#include <csignal>
25#include <cstdio> 26#include <cstdio>
26#include <cstdlib> 27#include <cstdlib>
27#include <cstring> 28#include <cstring>
@@ -166,6 +167,15 @@ void __cdecl game_c_exit() {}
166void __stdcall game_exit_process(UINT code) { end_run(static_cast<int>(code)); } 167void __stdcall game_exit_process(UINT code) { end_run(static_cast<int>(code)); }
167void __cdecl game_abort() { 168void __cdecl game_abort() {
168 std::fprintf(stderr, "[rt] process: the game called abort()\n"); 169 std::fprintf(stderr, "[rt] process: the game called abort()\n");
170 // The game's signal() import is not shimmed: its handler goes into the host CRT's process-wide table, which
171 // std::signal here reads too. UCRT's abort() raises SIGABRT before it terminates; do the same only when a
172 // handler is installed, because raising it with the default action would terminate the host process. A handler
173 // that exits ends the run itself; one that returns falls through to the CRT's abort code below.
174 const auto previous = std::signal(SIGABRT, SIG_DFL);
175 if (previous != SIG_ERR) {
176 std::signal(SIGABRT, previous);
177 if (previous != SIG_DFL && previous != SIG_IGN) std::raise(SIGABRT);
178 }
169 end_run(3); // the CRT's abort exit code 179 end_run(3); // the CRT's abort exit code
170} 180}
171 181