18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 03:24:58 +01:00

fix(physicslog): a log whose file can't be written keeps its lines and header, and the writer is stopped once on every way out

A failed write put its lines back, ahead of those since, so a file held by
another program for a while gets its header and every line once it can be
written; up to 4 MB kept per log. Stopping is joined once, and not from the
writer's own thread. main stops the logs after an error it caught too, and the
test watchdog flushes with a time limit, so a disk that doesn't answer doesn't
keep the run from ending.
This commit is contained in:
maj00r
2026-11-15 23:32:38 +01:00
parent 7b7529e24e
commit 7547e6bf07
5 changed files with 134 additions and 18 deletions

View File

@@ -242,6 +242,9 @@ int main(int argc, char *argv[])
MessageBoxA(nullptr, msg.c_str(), "Simulator crashed :(", MB_ICONERROR);
}
#endif
// the last two seconds of the physics logs, also after an error caught above; Application.exit() stops them
// otherwise, and a second stop only writes what came since
PhysicsLogs.stop();
}
#ifndef _WIN32
fflush(stdout);