@@ -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