diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2017-09-25 13:08:57 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2017-09-25 13:12:00 +0200 |
commit | e1e1a3aebb40459cd5db30c68ae4a995b451c9e0 (patch) | |
tree | 211189085bc4146f74068e2741e8e9098141fd42 /tests | |
parent | 72bcc163d0ecc09d6d92b73ed2500891e86a27fd (diff) |
tests: Handle errors when installing Cabal and continue
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CompileTest.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs index cc96999..09fa2be 100644 --- a/tests/CompileTest.hs +++ b/tests/CompileTest.hs @@ -1,7 +1,10 @@ +{-# LANGUAGE ScopedTypeVariables #-} + import System.Posix.Env (setEnv) import System.Process import System.Exit import System.IO +import Control.Exception as E import Data.List import Data.Maybe import Data.Version @@ -121,9 +124,13 @@ main = do compilePrivatePkgDb :: Either HEAD Version -> IO (Either ExitCode FilePath) compilePrivatePkgDb eCabalVer = do - (db, e_commit_ver) - <- installCabal defaultOptions { verbose = True } eCabalVer - compileWithPkg (Just db) e_commit_ver + res <- E.try $ installCabal defaultOptions { verbose = True } eCabalVer + case res of + Right (db, e_commit_ver) -> + compileWithPkg (Just db) e_commit_ver + Left (ioe :: IOException) -> do + print ioe + return $ Left (ExitFailure 1) compileWithPkg :: Maybe PackageDbDir -> Either String Version |