aboutsummaryrefslogtreecommitdiff
path: root/Annex/MakeRepo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-29 22:36:08 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-29 22:36:08 -0400
commitc85e2d09160e46d9bf38b711308708c8d13119d6 (patch)
tree8e22990c20f3551e87d96e15a0b5b05c6586cf38 /Annex/MakeRepo.hs
parentb8248cf826a69ca43d3fe462b6686407cb859c65 (diff)
fix process and FD leak
Fix process and file descriptor leak that was exposed when git-annex was built with ghc 8.2.1. Apparently ghc has changed its behavior of GC of open file handles that are pipes to running processes. That broke git-annex test on OSX due to running out of FDs. Audited for all uses of Annex.new and made stopCoProcesses be called once it's done with the state. Fixed several places that might have leaked in other situations than running the test suite. This commit was sponsored by Ewen McNeill.
Diffstat (limited to 'Annex/MakeRepo.hs')
-rw-r--r--Annex/MakeRepo.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Annex/MakeRepo.hs b/Annex/MakeRepo.hs
index adf49ed2c..e03196664 100644
--- a/Annex/MakeRepo.hs
+++ b/Annex/MakeRepo.hs
@@ -16,6 +16,7 @@ import qualified Git.Branch
import qualified Annex
import Annex.UUID
import Annex.Direct
+import Annex.Action
import Types.StandardGroups
import Logs.PreferredContent
import qualified Annex.Branch
@@ -42,7 +43,7 @@ makeRepo path bare = ifM (probeRepoExists path)
inDir :: FilePath -> Annex a -> IO a
inDir dir a = do
state <- Annex.new =<< Git.Config.read =<< Git.Construct.fromPath dir
- Annex.eval state a
+ Annex.eval state $ a `finally` stopCoProcesses
{- Creates a new repository, and returns its UUID. -}
initRepo :: Bool -> Bool -> FilePath -> Maybe String -> Maybe StandardGroup -> IO UUID