diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-02-27 07:23:06 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-02-27 07:23:06 +0000 |
commit | 29d2952a10583ec2d18fbe5118b32a5ec5752eb2 (patch) | |
tree | 1208daeff7cad4ff558f4dfef393bd8ca01606e2 | |
parent | bdb84bab4edc9c45c7e505709671687b7b32cb3f (diff) | |
download | pandoc-29d2952a10583ec2d18fbe5118b32a5ec5752eb2.tar.gz |
Setup.hs: replace readProcess with something more portable.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1553 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | Setup.hs | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1,10 +1,10 @@ import Distribution.Simple import Control.Exception ( bracket_ ) import Control.Monad ( unless ) -import System.Process ( runCommand, runProcess, waitForProcess, readProcess ) +import System.Process ( runCommand, runProcess, waitForProcess ) import System.FilePath ( (</>), (<.>) ) import System.Directory -import System.IO ( stderr ) +import System.IO ( stderr, openTempFile ) import System.Exit import System.Time import System.IO.Error ( isDoesNotExistError ) @@ -18,8 +18,11 @@ main = do -- | Run test suite. runTestSuite _ _ _ _ = do - vers <- readProcess ("dist" </> "build" </> "pandoc" </> "pandoc") ["--version"] "" - let highlightingSupport = "+highlighting" `isInfixOf` vers + tempPath <- catch getTemporaryDirectory (\_ -> return ".") + (outputPath, hOut) <- openTempFile tempPath "out" + runProcess "pandoc" ["--version"] Nothing Nothing Nothing (Just hOut) Nothing >>= waitForProcess + output <- readFile outputPath + let highlightingSupport = "+highlighting" `isInfixOf` output let testArgs = if highlightingSupport then ["lhs"] else [] let testCmd = "runhaskell -i.. RunTests.hs " ++ unwords testArgs inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith |