on master help sign in
Make --client use the correct handles
f7bd9f5David Raymond Christiansen
src/Idris/REPL.hs+8−5
@@ -151,7 +151,7 @@ startServer orig fn_in = do tid <- runIO $ forkOS serverLoop
151 -- TODO: option for port number
151 -- TODO: option for port number
152 serverLoop = withSocketsDo $
152 serverLoop = withSocketsDo $
153 do sock <- listenOnLocalhost $ PortNumber 4294
153 do sock <- listenOnLocalhost $ PortNumber 4294
154− loop fn orig sock
154+ loop fn orig { idris_colourRepl = False } sock
155
155
156 fn = case fn_in of
156 fn = case fn_in of
157 (f:_) -> f
157 (f:_) -> f
@@ -161,7 +161,10 @@ startServer orig fn_in = do tid <- runIO $ forkOS serverLoop
161 = do (h,_,_) <- accept sock
161 = do (h,_,_) <- accept sock
162 hSetEncoding h utf8
162 hSetEncoding h utf8
163 cmd <- hGetLine h
163 cmd <- hGetLine h
164+ let isth = case idris_outputmode ist of
165+ RawOutput _ -> ist {idris_outputmode = RawOutput h}
166+ IdeSlave n _ -> ist {idris_outputmode = IdeSlave n h}
164− (ist', fn) <- processNetCmd orig ist h fn cmd
167+ (ist', fn) <- processNetCmd orig isth h fn cmd
165 hClose h
168 hClose h
166 loop fn ist' sock
169 loop fn ist' sock
167
170
@@ -196,9 +199,9 @@ processNetCmd orig i h fn cmd
196 setOutH :: Handle -> Idris ()
199 setOutH :: Handle -> Idris ()
197 setOutH h =
200 setOutH h =
198 do ist <- getIState
201 do ist <- getIState
199− case idris_outputmode ist of
202+ putIState $ case idris_outputmode ist of
200− RawOutput _ -> putIState ist {idris_outputmode = RawOutput h}
203+ RawOutput _ -> ist {idris_outputmode = RawOutput h}
201− IdeSlave n _ -> putIState ist {idris_outputmode = IdeSlave n h}
204+ IdeSlave n _ -> ist {idris_outputmode = IdeSlave n h}
202
205
203-- | Run a command on the server on localhost
206-- | Run a command on the server on localhost
204runClient :: String -> IO ()
207runClient :: String -> IO ()