diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-13 11:23:04 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-13 11:23:04 -0400 |
| commit | 1555c6f88a0446d3e29149eff8315817696731e1 (patch) | |
| tree | 08185eff31752555922f315c38ca956a5401ce04 /src/Propellor/Protocol.hs | |
| parent | 7173fca59d1bc953ae74b54816b23a8488c7136d (diff) | |
trying the pipe trick again
With some small changes, and debugging.
Diffstat (limited to 'src/Propellor/Protocol.hs')
| -rw-r--r-- | src/Propellor/Protocol.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Propellor/Protocol.hs b/src/Propellor/Protocol.hs index ae7e0404..e90155f3 100644 --- a/src/Propellor/Protocol.hs +++ b/src/Propellor/Protocol.hs @@ -53,11 +53,7 @@ sendMarked' h marker s = do hFlush h getMarked :: Handle -> Marker -> IO (Maybe String) -getMarked h marker = do - -- Avoid buffering anything in Handle, so that the data after - -- the marker will be available to be read from the underlying Fd. - hSetBuffering stdin NoBuffering - go =<< catchMaybeIO (hGetLine h) +getMarked h marker = go =<< catchMaybeIO (hGetLine h) where go Nothing = return Nothing go (Just l) = case fromMarked marker l of @@ -69,8 +65,8 @@ getMarked h marker = do debug ["received marked", marker] return (Just v) -reqMarked :: Stage -> Marker -> (String -> IO ()) -> IO () -reqMarked stage marker a = do +req :: Stage -> Marker -> (String -> IO ()) -> IO () +req stage marker a = do debug ["requested marked", marker] sendMarked' stdout statusMarker (show stage) maybe noop a =<< getMarked stdin marker |
