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"

View file

@ -9,6 +9,9 @@ remote.
No indication of why it failed.
> Update: Now it shows the problem, which is that the exported file is
> locked so statting it fails. --[[Joey]]
The second test fails in an import. It gets as far as updating foo/master,
but then when it tries to merge that branch, there's a merge conflict.
That merge conflict seems very likely due to being on an adjusted branch;