[commit: packages/Cabal] ghc-head: Catch exceptions in findUsableBranchers (729cd55)

git at git.haskell.org git at git.haskell.org
Fri Sep 13 17:55:17 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=729cd551d93d4ce28e8a589d6b5ac638551e5fed

>---------------------------------------------------------------

commit 729cd551d93d4ce28e8a589d6b5ac638551e5fed
Author: Reid Barton <rwbarton at gmail.com>
Date:   Sun Sep 8 18:07:39 2013 -0400

    Catch exceptions in findUsableBranchers
    
    In the version of process that comes with GHC 7.7,
    readProcessWithExitCode raises an exception when
    the process could not be started (for example if
    the command to be run doesn't exist).


>---------------------------------------------------------------

729cd551d93d4ce28e8a589d6b5ac638551e5fed
 cabal-install/Distribution/Client/Get.hs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cabal-install/Distribution/Client/Get.hs b/cabal-install/Distribution/Client/Get.hs
index 35c0b82..873a812 100644
--- a/cabal-install/Distribution/Client/Get.hs
+++ b/cabal-install/Distribution/Client/Get.hs
@@ -39,7 +39,7 @@ import Distribution.Client.IndexUtils as IndexUtils
         ( getSourcePackages )
 
 import Control.Exception
-         ( finally )
+         ( catch, finally )
 import Control.Monad
          ( filterM, forM_, unless, when )
 import Data.List
@@ -204,7 +204,7 @@ allBranchers =
 -- exits successfully, that brancher is considered usable.
 findUsableBranchers :: IO (Data.Map.Map PD.RepoType Brancher)
 findUsableBranchers = do
-    let usable (_, brancher) = do
+    let usable (_, brancher) = flip catch (const (return False) :: IOError -> IO Bool) $ do
          let cmd = brancherBinary brancher
          (exitCode, _, _) <- readProcessWithExitCode cmd ["--help"] ""
          return (exitCode == ExitSuccess)




More information about the ghc-commits mailing list