diff options
author | tv <tv@krebsco.de> | 2019-01-27 19:59:11 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-27 20:18:05 +0100 |
commit | 24d095cad7969a7bdadd1fa05c4742f4d66033e6 (patch) | |
tree | ba880690dc6dc39cfe2b512450ff8743ea3caf40 /src/Reaktor/Plugins | |
parent | f91b27cf8dce8a92c0b296209323a79cc1e36873 (diff) |
Reaktor.Plugins.System.hWithLines: use untilM_
Diffstat (limited to 'src/Reaktor/Plugins')
-rw-r--r-- | src/Reaktor/Plugins/System.hs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/Reaktor/Plugins/System.hs b/src/Reaktor/Plugins/System.hs index 8ca468c..de96a61 100644 --- a/src/Reaktor/Plugins/System.hs +++ b/src/Reaktor/Plugins/System.hs @@ -10,7 +10,7 @@ import Control.Applicative import Control.Concurrent (forkIO,threadDelay) import Control.Concurrent.Async (race) import Control.Exception -import Control.Monad (forM_) +import Control.Monad.Extended (forM_,untilM_) import qualified Data.HashMap.Lazy as M import qualified Data.List as L import qualified Data.Text.Extended as T @@ -217,9 +217,4 @@ signalProcessGroup' sig pgid = hWithLines :: Handle -> (Text -> IO ()) -> IO () hWithLines h f = do hSetBuffering h LineBuffering - go `finally` hClose h - where - go = - hIsEOF h >>= \case - True -> return () - False -> T.hGetLine h >>= f >> go + untilM_ (hIsEOF h) (T.hGetLine h >>= f) `finally` hClose h |