error handling for doc.
This commit is contained in:
parent
187f718de0
commit
5dbea7b909
@ -14,9 +14,12 @@ packageDoc _ cradle mdl = pkgDoc cradle mdl
|
|||||||
pkgDoc :: Cradle -> String -> IO String
|
pkgDoc :: Cradle -> String -> IO String
|
||||||
pkgDoc cradle mdl = do
|
pkgDoc cradle mdl = do
|
||||||
pkg <- trim <$> readProcess "ghc-pkg" toModuleOpts []
|
pkg <- trim <$> readProcess "ghc-pkg" toModuleOpts []
|
||||||
htmlpath <- readProcess "ghc-pkg" ["field", pkg, "haddock-html"] []
|
if pkg == "" then
|
||||||
let ret = pkg ++ " " ++ drop 14 htmlpath
|
return "\n"
|
||||||
return ret
|
else do
|
||||||
|
htmlpath <- readProcess "ghc-pkg" ["field", pkg, "haddock-html"] []
|
||||||
|
let ret = pkg ++ " " ++ drop 14 htmlpath
|
||||||
|
return ret
|
||||||
where
|
where
|
||||||
toModuleOpts = ["find-module", "--simple-output"] ++ cradlePackageDbOpts cradle ++ [mdl]
|
toModuleOpts = ["find-module", "--simple-output"] ++ cradlePackageDbOpts cradle ++ [mdl]
|
||||||
trim = takeWhile (/= '\n')
|
trim = takeWhile (/= '\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user