From a61df2dd0467435857af76c9f5c371419f25a75c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Jun 2013 21:12:09 -0400 Subject: 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. --- Annex/Link.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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. - -- cgit v1.2.3