gameServer/OfficialServer/checker.hs
changeset 9403 9f6ca48d8e9c
parent 9399 1767c92eff37
child 9421 90fe753b3654
--- 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