on master help sign in
Make --client use the correct handles
commitf7bd9f5ffd718fc95b7340cbc00c2d49b133d07e authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateMon 4 Aug 2014, 17:51 (12 years ago) parent705dbe1
1 file changed+8−5
src/Idris/REPL.hs+8−5
src/Idris/REPL.hs+8−5
@@ -151,7 +151,7 @@ startServer orig fn_in = do tid <- runIO $ forkOS serverLoop
151151 -- TODO: option for port number
152152 serverLoop = withSocketsDo $
153153 do sock <- listenOnLocalhost $ PortNumber 4294
154− loop fn orig sock
154+ loop fn orig { idris_colourRepl = False } sock
155155
156156 fn = case fn_in of
157157 (f:_) -> f
@@ -161,7 +161,10 @@ startServer orig fn_in = do tid <- runIO $ forkOS serverLoop
161161 = do (h,_,_) <- accept sock
162162 hSetEncoding h utf8
163163 cmd <- hGetLine h
164− (ist', fn) <- processNetCmd orig ist h fn cmd
164+ let isth = case idris_outputmode ist of
165+ RawOutput _ -> ist {idris_outputmode = RawOutput h}
166+ IdeSlave n _ -> ist {idris_outputmode = IdeSlave n h}
167+ (ist', fn) <- processNetCmd orig isth h fn cmd
165168 hClose h
166169 loop fn ist' sock
167170
@@ -196,9 +199,9 @@ processNetCmd orig i h fn cmd
196199 setOutH :: Handle -> Idris ()
197200 setOutH h =
198201 do ist <- getIState
199− case idris_outputmode ist of
200− RawOutput _ -> putIState ist {idris_outputmode = RawOutput h}
201− IdeSlave n _ -> putIState ist {idris_outputmode = IdeSlave n h}
202+ putIState $ case idris_outputmode ist of
203+ RawOutput _ -> ist {idris_outputmode = RawOutput h}
204+ IdeSlave n _ -> ist {idris_outputmode = IdeSlave n h}
202205
203206-- | Run a command on the server on localhost
204207runClient :: String -> IO ()