diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-10-27 21:52:31 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-10-27 21:52:31 +0000 |
commit | 096413b2f35a8386eeecebcabbf04f0cde580857 (patch) | |
tree | 629ff03aec6195eaae9f7a0c1d44a189d965de07 | |
parent | 0b3d8581a3f1c52c4bd1a1263a4434740e22043a (diff) | |
download | pandoc-096413b2f35a8386eeecebcabbf04f0cde580857.tar.gz |
Fixed Setup.hs so correct status is returned after build.
Previously an error status was returned even after a normal
build. Resolves Issue #100.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1471 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | Setup.hs | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -1,6 +1,7 @@ import Distribution.Simple import Distribution.PackageDescription ( emptyHookedBuildInfo ) import Control.Exception ( bracket_ ) +import Control.Monad ( unless ) import System.Process ( runCommand, runProcess, waitForProcess ) import System.FilePath ( (</>), (<.>) ) import System.Directory @@ -10,9 +11,10 @@ import System.Time import System.IO.Error ( isDoesNotExistError ) import Data.Maybe ( fromJust, isNothing, catMaybes ) -main = defaultMainWithHooks $ - simpleUserHooks { runTests = runTestSuite - , postBuild = makeManPages } +main = do + defaultMainWithHooks $ simpleUserHooks { runTests = runTestSuite + , postBuild = makeManPages } + exitWith ExitSuccess -- | Run test suite. runTestSuite _ _ _ _ = do @@ -20,8 +22,7 @@ runTestSuite _ _ _ _ = do -- | Build man pages from markdown sources in man/man1/. makeManPages _ _ _ _ = do - mapM makeManPage ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"] - return () + mapM_ makeManPage ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"] -- | Build a man page from markdown source in man/man1. makeManPage manpage = do @@ -30,14 +31,13 @@ makeManPage manpage = do let page = manDir </> manpage let source = manDir </> manpage <.> "md" modifiedDeps <- modifiedDependencies page [source] - if null modifiedDeps - then return () - else do - ec <- runProcess pandoc ["-s", "-S", "-r", "markdown", "-w", "man", "-o", page, source] - Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess - case ec of - ExitSuccess -> putStrLn $ "Created " ++ manDir </> manpage - _ -> error $ "Error creating " ++ manDir </> manpage + unless (null modifiedDeps) $ do + ec <- runProcess pandoc ["-s", "-S", "-r", "markdown", "-w", "man", "-o", page, source] + Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess + case ec of + ExitSuccess -> putStrLn $ "Created " ++ manDir </> manpage + _ -> do putStrLn $ "Error creating " ++ manDir </> manpage + exitWith ec -- | Returns a list of 'dependencies' that have been modified after 'file'. modifiedDependencies :: FilePath -> [FilePath] -> IO [FilePath] |