error handling for doc.

This commit is contained in:
Kazu Yamamoto 2014-03-27 16:40:34 +09:00
parent 187f718de0
commit 5dbea7b909

View File

@ -14,6 +14,9 @@ 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 []
if pkg == "" then
return "\n"
else do
htmlpath <- readProcess "ghc-pkg" ["field", pkg, "haddock-html"] [] htmlpath <- readProcess "ghc-pkg" ["field", pkg, "haddock-html"] []
let ret = pkg ++ " " ++ drop 14 htmlpath let ret = pkg ++ " " ++ drop 14 htmlpath
return ret return ret