close handle so windows can stat the file

windows cannot stat a file that another process has open, which caused
this to crash with an exception
This commit is contained in:
Joey Hess 2019-08-13 13:26:25 -04:00
parent 3049271fd0
commit 386c0ce90a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 4 additions and 0 deletions

View file

@ -404,6 +404,7 @@ storeExportWithContentIdentifierM dir src _k loc overwritablecids p =
withTmpFileIn destdir template $ \tmpf tmph -> do
liftIO $ withMeteredFile src p (L.hPut tmph)
liftIO $ hFlush tmph
liftIO $ hClose tmph
liftIO (getFileStatus tmpf) >>= liftIO . mkContentIdentifier tmpf >>= \case
Nothing ->
return $ Left "unable to generate content identifier"