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)
|
go (SkeinHash hashsize) = use (skeinHasher hashsize)
|
||||||
|
|
||||||
use hasher = liftIO $ do
|
use hasher = liftIO $ do
|
||||||
hdl <- openBinaryFile file ReadMode
|
h <- hasher <$> L.readFile file
|
||||||
b <- L.hGetContents hdl
|
-- Force full evaluation so file is read and closed.
|
||||||
let !hsh = hasher b
|
return (length h `seq` h)
|
||||||
hClose hdl
|
|
||||||
return hsh
|
|
||||||
|
|
||||||
usehasher hashsize = case shaHasher hashsize filesize of
|
usehasher hashsize = case shaHasher hashsize filesize of
|
||||||
Left sha -> use sha
|
Left sha -> use sha
|
||||||
|
|
Loading…
Reference in a new issue