mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 18:09:58 -04:00
Write the log file before stderr, and keep a blocked console from stopping the log and the exit.
A selection in the console window of a game started directly held back the write to stderr, and with it the log file, the exit hook and the crash report. The log file now comes first, stderr goes past the C runtime's stream lock, and the lines of an exit, a fatal error or a crash skip stderr while another thread is stuck in it. A game run turns the console's QuickEdit mode off, and a closed console, Ctrl+C or Ctrl+Break ends the game the way a closed window does, with the settings and saves written and the exit logged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1884,6 +1884,21 @@ int plat_stderr_path(char *out, size_t cap) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int plat_stderr_write(const void *p, size_t n) {
|
||||
for (const char *c = p; n;) {
|
||||
ssize_t k = write(2, c, n);
|
||||
if (k < 0 && errno == EINTR) continue;
|
||||
if (k <= 0) return 0;
|
||||
c += k, n -= (size_t)k;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int plat_console_setup(void (*on_close)(const char *what)) { // a Windows console's settings only
|
||||
(void)on_close;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---- process
|
||||
|
||||
#ifdef NX2NAVI_PGO_GEN
|
||||
|
||||
Reference in New Issue
Block a user