aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-02-27 07:23:06 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-02-27 07:23:06 +0000
commit29d2952a10583ec2d18fbe5118b32a5ec5752eb2 (patch)
tree1208daeff7cad4ff558f4dfef393bd8ca01606e2
parentbdb84bab4edc9c45c7e505709671687b7b32cb3f (diff)
downloadpandoc-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.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Setup.hs b/Setup.hs
index d40639d8d..4dc25449d 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -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