summaryrefslogtreecommitdiff
path: root/Propellor
diff options
context:
space:
mode:
authorJoey Hess2014-04-20 11:38:50 -0400
committerJoey Hess2014-04-20 11:38:50 -0400
commitf373e73ada78951f99118129bfcf9793e461e296 (patch)
tree78665beac64af6f153720b9cd2a668707be620d7 /Propellor
parent63d707330808c1a0a0f7774597c3e5fc57a0a4cc (diff)
propellor spin
Diffstat (limited to 'Propellor')
-rw-r--r--Propellor/SimpleSh.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Propellor/SimpleSh.hs b/Propellor/SimpleSh.hs
index 7e0f19ff..c088eda7 100644
--- a/Propellor/SimpleSh.hs
+++ b/Propellor/SimpleSh.hs
@@ -32,7 +32,6 @@ simpleSh namedpipe = do
forever $ do
(client, _addr) <- accept s
h <- socketToHandle client ReadWriteMode
- hSetBuffering h LineBuffering
maybe noop (run h) . readish =<< hGetLine h
where
run h (Cmd cmd params) = do
@@ -47,6 +46,7 @@ simpleSh namedpipe = do
let runwriter = do
v <- readChan chan
hPutStrLn h (show v)
+ hFlush h
case v of
Done -> noop
_ -> runwriter
@@ -73,8 +73,8 @@ simpleShClient namedpipe cmd params handler = do
s <- socket AF_UNIX Stream defaultProtocol
connect s (SockAddrUnix namedpipe)
h <- socketToHandle s ReadWriteMode
- hSetBuffering h LineBuffering
hPutStrLn h $ show $ Cmd cmd params
+ hFlush h
resps <- catMaybes . map readish . lines <$> hGetContents h
hClose h `after` handler resps