diff options
author | Joey Hess <joey@kitenet.net> | 2014-04-08 14:02:25 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-04-08 14:02:25 -0400 |
commit | 9b09962ee86ec7531d7ca946e62ccf6a48a67399 (patch) | |
tree | 13449e83e80b6e1b788c0e0996b0412038579340 /RemoteDaemon | |
parent | f2426676defafecc904234de3522f57ebf7ab19d (diff) |
remotedaemon: avoid extraneous stdout output
Diffstat (limited to 'RemoteDaemon')
-rw-r--r-- | RemoteDaemon/Core.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/RemoteDaemon/Core.hs b/RemoteDaemon/Core.hs index a220e5807..b32be98ef 100644 --- a/RemoteDaemon/Core.hs +++ b/RemoteDaemon/Core.hs @@ -26,18 +26,19 @@ import qualified Data.Map as M runForeground :: IO () runForeground = do + (readh, writeh) <- ioHandles ichan <- newChan :: IO (Chan Consumed) ochan <- newChan :: IO (Chan Emitted) let reader = forever $ do - l <- getLine + l <- hGetLine readh case parseMessage l of Nothing -> error $ "protocol error: " ++ l Just cmd -> writeChan ichan cmd let writer = forever $ do msg <- readChan ochan - putStrLn $ unwords $ formatMessage msg - hFlush stdout + hPutStrLn writeh $ unwords $ formatMessage msg + hFlush writeh let controller = runController ichan ochan -- If any thread fails, the rest will be killed. |