aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-10-27 21:52:31 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-10-27 21:52:31 +0000
commit096413b2f35a8386eeecebcabbf04f0cde580857 (patch)
tree629ff03aec6195eaae9f7a0c1d44a189d965de07
parent0b3d8581a3f1c52c4bd1a1263a4434740e22043a (diff)
downloadpandoc-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.hs26
1 files changed, 13 insertions, 13 deletions
diff --git a/Setup.hs b/Setup.hs
index 41ea29f7d..03185dacd 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -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]