git.iko.soy/typeable/pandoc
on master help sign in
Setup.hs: replace readProcess with something more portable.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1553 788f1e2b-df1e-0410-8736-df70ead52e1b

commit29d2952a10583ec2d18fbe5118b32a5ec5752eb2 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateFri 27 Feb 2009, 07:23 (18 years ago) parentbdb84ba
1 file changed+7−4
Setup.hs+7−4
Setup.hs+7−4
@@ -1,10 +1,10 @@
11import Distribution.Simple
22import Control.Exception ( bracket_ )
33import Control.Monad ( unless )
4−import System.Process ( runCommand, runProcess, waitForProcess, readProcess )
4+import System.Process ( runCommand, runProcess, waitForProcess )
55import System.FilePath ( (</>), (<.>) )
66import System.Directory
7−import System.IO ( stderr )
7+import System.IO ( stderr, openTempFile )
88import System.Exit
99import System.Time
1010import System.IO.Error ( isDoesNotExistError )
@@ -18,8 +18,11 @@ main = do
1818
1919-- | Run test suite.
2020runTestSuite _ _ _ _ = do
21− vers <- readProcess ("dist" </> "build" </> "pandoc" </> "pandoc") ["--version"] ""
22− let highlightingSupport = "+highlighting" `isInfixOf` vers
21+ tempPath <- catch getTemporaryDirectory (\_ -> return ".")
22+ (outputPath, hOut) <- openTempFile tempPath "out"
23+ runProcess "pandoc" ["--version"] Nothing Nothing Nothing (Just hOut) Nothing >>= waitForProcess
24+ output <- readFile outputPath
25+ let highlightingSupport = "+highlighting" `isInfixOf` output
2326 let testArgs = if highlightingSupport then ["lhs"] else []
2427 let testCmd = "runhaskell -i.. RunTests.hs " ++ unwords testArgs
2528 inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith