diff options
author | 2014-07-13 22:27:37 -0400 | |
---|---|---|
committer | 2014-07-13 22:33:28 -0400 | |
commit | d242881e69dbf4195016c562365b63dd5edb7918 (patch) | |
tree | 0c9b5c151b8523366aa1618cd9ae2b723f16b533 | |
parent | c7fb5b96383bf4575044f0d57a35f5b49adadbfd (diff) |
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.
-rw-r--r-- | Utility/ExternalSHA.hs | 3 |
1 files changed, 2 insertions, 1 deletions
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 -} |