equal
deleted
inserted
replaced
30 deriving Show |
30 deriving Show |
31 |
31 |
32 serverAddress = "netserver.hedgewars.org" |
32 serverAddress = "netserver.hedgewars.org" |
33 protocolNumber = "43" |
33 protocolNumber = "43" |
34 |
34 |
|
35 getLines :: Handle -> IO [String] |
|
36 getLines h = g |
|
37 where |
|
38 g = do |
|
39 l <- liftM Just (hGetLine h) `Exception.catch` (\(_ :: Exception.IOException) -> return Nothing) |
|
40 if isNothing l then |
|
41 return [] |
|
42 else |
|
43 do |
|
44 lst <- g |
|
45 return $ fromJust l : lst |
|
46 |
35 |
47 |
36 engineListener :: Chan Message -> Handle -> IO () |
48 engineListener :: Chan Message -> Handle -> IO () |
37 engineListener coreChan h = do |
49 engineListener coreChan h = do |
38 output <- liftM lines $ hGetContents h |
50 output <- getLines h |
39 debugM "Engine" $ show output |
51 debugM "Engine" $ show output |
40 if isNothing $ L.find start output then |
52 if isNothing $ L.find start output then |
41 writeChan coreChan $ CheckFailed "No stats msg" |
53 writeChan coreChan $ CheckFailed "No stats msg" |
42 else |
54 else |
43 writeChan coreChan $ CheckSuccess [] |
55 writeChan coreChan $ CheckSuccess [] |