diff options
author | Joey Hess <joey@kitenet.net> | 2013-06-17 21:12:09 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-06-17 21:12:09 -0400 |
commit | a61df2dd0467435857af76c9f5c371419f25a75c (patch) | |
tree | b6a3ec5fe878b4d07c3676be32e79f9aecb99c4f /Annex/Link.hs | |
parent | 83e33ab6c16ff377e56abda7bba1b364bec5e1f7 (diff) |
avoid lazy read of file contents
On Windows, that means the file could still be open when later code wants
to delete it, which fails. Since we're only reading 8k anyway, just read
it, strictly. However, avoid reading the whole file strictly, so no
getContentsStrict here.
Diffstat (limited to 'Annex/Link.hs')
-rw-r--r-- | Annex/Link.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Annex/Link.hs b/Annex/Link.hs index 71608ba2a..72c84c0c8 100644 --- a/Annex/Link.hs +++ b/Annex/Link.hs @@ -52,7 +52,8 @@ getAnnexLinkTarget file = readfilestart f = do h <- openFile f ReadMode fileEncoding h - take 8192 <$> hGetContents h + s <- take 8192 <$> hGetContents h + length s `seq` (hClose h >> return s) {- Creates a link on disk. - |