diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-23 13:54:02 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-23 13:54:02 -0400 |
| commit | 792957153ca9c22de28da7be83940aa5e07af0fa (patch) | |
| tree | 3963b00a1d2a594d890adff4181895536e4c9f07 /Propellor/SimpleSh.hs | |
| parent | 50fb9961f3dfd5fcce8875c6b2b216da35cf7c42 (diff) | |
| parent | fa45d9f47ca07a99af6c9f7a335f8522836426da (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'Propellor/SimpleSh.hs')
| -rw-r--r-- | Propellor/SimpleSh.hs | 4 |
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 |
