Setup.hs: replace readProcess with something more portable.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1553 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
bdb84bab4e
commit
29d2952a10
1 changed files with 7 additions and 4 deletions
11
Setup.hs
11
Setup.hs
|
@ -1,10 +1,10 @@
|
||||||
import Distribution.Simple
|
import Distribution.Simple
|
||||||
import Control.Exception ( bracket_ )
|
import Control.Exception ( bracket_ )
|
||||||
import Control.Monad ( unless )
|
import Control.Monad ( unless )
|
||||||
import System.Process ( runCommand, runProcess, waitForProcess, readProcess )
|
import System.Process ( runCommand, runProcess, waitForProcess )
|
||||||
import System.FilePath ( (</>), (<.>) )
|
import System.FilePath ( (</>), (<.>) )
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.IO ( stderr )
|
import System.IO ( stderr, openTempFile )
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.Time
|
import System.Time
|
||||||
import System.IO.Error ( isDoesNotExistError )
|
import System.IO.Error ( isDoesNotExistError )
|
||||||
|
@ -18,8 +18,11 @@ main = do
|
||||||
|
|
||||||
-- | Run test suite.
|
-- | Run test suite.
|
||||||
runTestSuite _ _ _ _ = do
|
runTestSuite _ _ _ _ = do
|
||||||
vers <- readProcess ("dist" </> "build" </> "pandoc" </> "pandoc") ["--version"] ""
|
tempPath <- catch getTemporaryDirectory (\_ -> return ".")
|
||||||
let highlightingSupport = "+highlighting" `isInfixOf` vers
|
(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 testArgs = if highlightingSupport then ["lhs"] else []
|
||||||
let testCmd = "runhaskell -i.. RunTests.hs " ++ unwords testArgs
|
let testCmd = "runhaskell -i.. RunTests.hs " ++ unwords testArgs
|
||||||
inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith
|
inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith
|
||||||
|
|
Loading…
Reference in a new issue