deal with process-1.2.0.0 throwing an exception when program DNE (may only fix the tip of the iceberg)

Configure crashed on systems with that process and without eg, sha256sum.

The rest of the code in configure looks to work ok, since it uses sh -c to
probe for commands, and sh is always in path so it works.

Dunno about all the rest of git-annex. Not a huge amount of external
program use, other than git, so perhaps this won't be a large pain.

Note that boolSystem can throw an exception now if the program doesn't
exist. Could easily be changed back to False.
This commit is contained in:
Joey Hess 2014-07-13 22:27:37 -04:00
parent 3a7ae6f144
commit e36439d4fe

View file

@ -14,6 +14,7 @@ import Utility.SafeCommand
import Utility.Process import Utility.Process
import Utility.FileSystemEncoding import Utility.FileSystemEncoding
import Utility.Misc import Utility.Misc
import Utility.Exception
import Data.List import Data.List
import Data.Char import Data.Char
@ -22,7 +23,7 @@ import System.IO
externalSHA :: String -> Int -> FilePath -> IO (Either String String) externalSHA :: String -> Int -> FilePath -> IO (Either String String)
externalSHA command shasize file = do externalSHA command shasize file = do
ls <- lines <$> readsha (toCommand [File file]) ls <- lines <$> catchDefaultIO "" (readsha (toCommand [File file]))
return $ sanitycheck =<< parse ls return $ sanitycheck =<< parse ls
where where
{- sha commands output the filename, so need to set fileEncoding -} {- sha commands output the filename, so need to set fileEncoding -}