avoid exception when curl exits nonzero (due to eg, bad domain name)

This commit is contained in:
Joey Hess 2014-03-27 13:01:57 -04:00
parent 1b3da6a089
commit 16387edd00

View file

@ -77,7 +77,8 @@ exists url uo = case parseURIRelaxed url of
Nothing -> dne Nothing -> dne
| otherwise -> if Build.SysConfig.curl | otherwise -> if Build.SysConfig.curl
then do then do
output <- readProcess "curl" $ toCommand curlparams output <- catchDefaultIO "" $
readProcess "curl" $ toCommand curlparams
case lastMaybe (lines output) of case lastMaybe (lines output) of
Just ('2':_:_) -> return (True, extractsize output) Just ('2':_:_) -> return (True, extractsize output)
_ -> dne _ -> dne