From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 3 Mar 2015 00:37:57 +0000 (+0100)
Subject: Server/py: Fix out file writing bug.
X-Git-Tag: tce~436
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/add_task?a=commitdiff_plain;h=21ba1d03b1e883564d301c2781039017dd704b20;p=plomrogue

Server/py: Fix out file writing bug.
---

diff --git a/plomrogue-server.py b/plomrogue-server.py
index b921f4b..d6c1930 100755
--- a/plomrogue-server.py
+++ b/plomrogue-server.py
@@ -270,7 +270,9 @@ def try_worldstate_update():
             string = string + line + "\n"
         # TODO: no proper user-subjective map
         atomic_write(io_db["path_worldstate"], string)
-        atomic_write(io_db["path_out"], "WORLD_UPDATED\n", do_append=True)
+        io_db["file_out"].write("WORLD_UPDATED\n")
+        io_db["file_out"].flush()
+        os.fsync(io_db["file_out"])
         io_db["worldstate_updateable"] = False
 
 
@@ -416,6 +418,7 @@ def command_ping():
     """Send PONG line to server output file."""
     io_db["file_out"].write("PONG\n")
     io_db["file_out"].flush()
+    os.fsync(io_db["file_out"].fileno())
 
 
 def command_quit():