aboutsummaryrefslogtreecommitdiff
path: root/RemoteDaemon
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-08 14:02:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-08 14:02:25 -0400
commit9b09962ee86ec7531d7ca946e62ccf6a48a67399 (patch)
tree13449e83e80b6e1b788c0e0996b0412038579340 /RemoteDaemon
parentf2426676defafecc904234de3522f57ebf7ab19d (diff)
remotedaemon: avoid extraneous stdout output
Diffstat (limited to 'RemoteDaemon')
-rw-r--r--RemoteDaemon/Core.hs7
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.