fix(server/game): write saves through a temp file
This commit is contained in:
1 parent
c16c95db94
commit
cc7ec21ab9
2 files changed
+37
-8
No files matched your search
@@ -311,6 +311,15 @@ void testLogFormat() {
|
||||
"the banner names its rows");
|
||||
}
|
||||
|
||||
void testSafeWrite() {
|
||||
const std::string path = "build/test-safe-write.json";
|
||||
check(util::writeFile(path, "first"), "a file writes");
|
||||
check(util::writeFile(path, "second, and longer"), "and overwrites");
|
||||
bool ok = false;
|
||||
check(util::readFile(path, &ok) == "second, and longer" && ok, "with the new content whole");
|
||||
check(!util::fileExists(path + ".tmp"), "leaving no temp file behind");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
@@ -324,6 +333,7 @@ int main() {
|
||||
testLineupCmdIds();
|
||||
testIdleTimeout();
|
||||
testLogFormat();
|
||||
testSafeWrite();
|
||||
testFillPresence();
|
||||
testLargeMessage();
|
||||
testAgainstProtoc();
|
||||
|
||||
Reference in new issue
Block a user