better forcing of hash
This commit is contained in:
parent
facc50d965
commit
ac8af8da07
1 changed files with 3 additions and 5 deletions
|
@ -171,11 +171,9 @@ hashFile hash file filesize = go hash
|
|||
go (SkeinHash hashsize) = use (skeinHasher hashsize)
|
||||
|
||||
use hasher = liftIO $ do
|
||||
hdl <- openBinaryFile file ReadMode
|
||||
b <- L.hGetContents hdl
|
||||
let !hsh = hasher b
|
||||
hClose hdl
|
||||
return hsh
|
||||
h <- hasher <$> L.readFile file
|
||||
-- Force full evaluation so file is read and closed.
|
||||
return (length h `seq` h)
|
||||
|
||||
usehasher hashsize = case shaHasher hashsize filesize of
|
||||
Left sha -> use sha
|
||||
|
|
Loading…
Reference in a new issue