From 21ba1d03b1e883564d301c2781039017dd704b20 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 3 Mar 2015 01:37:57 +0100
Subject: [PATCH] Server/py: Fix out file writing bug.

---
 plomrogue-server.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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():
-- 
2.30.2