From d242881e69dbf4195016c562365b63dd5edb7918 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Jul 2014 22:27:37 -0400 Subject: 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. --- Utility/ExternalSHA.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Utility') diff --git a/Utility/ExternalSHA.hs b/Utility/ExternalSHA.hs index 1ab93262d..595acd8cf 100644 --- a/Utility/ExternalSHA.hs +++ b/Utility/ExternalSHA.hs @@ -14,6 +14,7 @@ import Utility.SafeCommand import Utility.Process import Utility.FileSystemEncoding import Utility.Misc +import Utility.Exception import Data.List import Data.Char @@ -22,7 +23,7 @@ import System.IO externalSHA :: String -> Int -> FilePath -> IO (Either String String) externalSHA command shasize file = do - ls <- lines <$> readsha (toCommand [File file]) + ls <- lines <$> catchDefaultIO "" (readsha (toCommand [File file])) return $ sanitycheck =<< parse ls where {- sha commands output the filename, so need to set fileEncoding -} -- cgit v1.2.3