converted reads from stderr to use hGetLineUntilExitOrEOF
These are all unlikely to suffer from the inherited stderr fd problem, but who knows, it could happen.
This commit is contained in:
parent
613455e059
commit
ff0927bde9
3 changed files with 27 additions and 15 deletions
|
@ -225,16 +225,19 @@ youtubeDlFileNameHtmlOnly' url uo
|
|||
liftIO $ withCreateProcess p waitproc
|
||||
|
||||
waitproc Nothing (Just o) (Just e) pid = do
|
||||
output <- fmap fst $
|
||||
hGetContentsStrict o
|
||||
`concurrently`
|
||||
hGetContentsStrict e
|
||||
errt <- async $ discardstderr pid e
|
||||
output <- hGetContentsStrict o
|
||||
ok <- liftIO $ checkSuccessProcess pid
|
||||
wait errt
|
||||
return $ case (ok, lines output) of
|
||||
(True, (f:_)) | not (null f) -> Right f
|
||||
_ -> nomedia
|
||||
waitproc _ _ _ _ = error "internal"
|
||||
|
||||
discardstderr pid e = hGetLineUntilExitOrEOF pid e >>= \case
|
||||
Nothing -> return ()
|
||||
Just _ -> discardstderr pid e
|
||||
|
||||
nomedia = Left "no media in url"
|
||||
|
||||
youtubeDlOpts :: [CommandParam] -> Annex [CommandParam]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue