Fixes to checker
authorunc0rr
Sun, 18 Aug 2013 17:52:32 +0400
changeset 9403 9f6ca48d8e9c
parent 9401 2af7bea32e5e
child 9405 efc5409a141d
Fixes to checker
gameServer/OfficialServer/checker.hs
--- a/gameServer/OfficialServer/checker.hs	Sun Aug 18 17:29:17 2013 +0400
+++ b/gameServer/OfficialServer/checker.hs	Sun Aug 18 17:52:32 2013 +0400
@@ -47,7 +47,7 @@
 
 engineListener :: Chan Message -> Handle -> String -> IO ()
 engineListener coreChan h fileName = do
-    stats <- liftM (L.dropWhile start) $ getLines h
+    stats <- liftM (L.takeWhile (not . B.null) . L.dropWhile (not . start)) $ getLines h
     debugM "Engine" $ show stats
     if null stats then
         writeChan coreChan $ CheckFailed "No stats msg"
@@ -63,18 +63,18 @@
 checkReplay coreChan msgs = do
     tempDir <- getTemporaryDirectory
     (fileName, h) <- openBinaryTempFile tempDir "checker-demo"
-    B.hPut h . BW.pack . concat . map (fromJust . Base64.decode . B.unpack) $ msgs
+    B.hPut h . BW.pack . concat . map (fromMaybe [] . Base64.decode . B.unpack) $ msgs
     hFlush h
     hClose h
 
-    (_, Just hOut, _, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.19/bin/hwengine"
+    (_, _, Just hOut, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.19/bin/hwengine"
                 [fileName
                 , "--user-prefix", "/usr/home/unC0Rr/.hedgewars"
                 , "--prefix", "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.19/share/hedgewars/Data"
                 , "--nomusic"
                 , "--nosound"
                 ])
-            {std_out = CreatePipe}
+            {std_err = CreatePipe}
     hSetBuffering hOut LineBuffering
     void $ forkIO $ engineListener coreChan hOut fileName