meterupdate bytes
feedprogress sendtotalsize' bytes buf' h
- handlestderr ph h = unlessM (hIsEOF h) $ do
- cancelOnExit ph (hGetLine h) >>= \case
- Just l -> do
- stderrHandler oh l
- handlestderr ph h
- Nothing -> return ()
+ handlestderr ph h = hGetLineUntilExitOrEOF ph h >>= \case
+ Just l -> do
+ stderrHandler oh l
+ handlestderr ph h
+ Nothing -> return ()
{- Runs a command, that may display one or more progress meters on
- either stdout or stderr, and prevents the meters from being displayed.
- beginning of the line when updating a progress display).
-}
avoidProgress :: Bool -> ProcessHandle -> Handle -> (String -> IO ()) -> IO ()
-avoidProgress doavoid ph h emitter = unlessM (hIsEOF h) $
- cancelOnExit ph (hGetLine h) >>= \case
- Just s -> do
- unless (doavoid && '\r' `elem` s) $
- emitter s
- avoidProgress doavoid ph h emitter
- Nothing -> return ()
+avoidProgress doavoid ph h emitter = hGetLineUntilExitOrEOF ph h >>= \case
+ Just s -> do
+ unless (doavoid && '\r' `elem` s) $
+ emitter s
+ avoidProgress doavoid ph h emitter
+ Nothing -> return ()
outputFilter
:: FilePath
void $ waitForProcess pid
#endif
-{- | Like hGetLine, reads a line from the Handle. If the Handle is already
- - closed, returns Nothing. If the process exits without writing a line,
- - also returns Nothing.
+{- | Like hGetLine, reads a line from the Handle. Returns Nothing if end of
+ - file is reached, or if the process has exited and there is nothing more
+ - buffered to read from the handle.
-
- This is useful to protect against situations where the process might
- have transferred the handle being read to another process, and so