aboutsummaryrefslogtreecommitdiff
path: root/Test.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 /Test.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 'Test.hs')
-rw-r--r--Test.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Test.hs b/Test.hs
index 5c3f362b5..1fe52ea4a 100644
--- a/Test.hs
+++ b/Test.hs
@@ -82,6 +82,7 @@ import qualified Annex.AdjustedBranch
import qualified Annex.VectorClock
import qualified Annex.View
import qualified Annex.View.ViewedFile
+import qualified Annex.Action
import qualified Logs.View
import qualified Utility.Path
import qualified Utility.FileMode
@@ -1778,7 +1779,7 @@ annexeval a = do
s <- Annex.new =<< Git.CurrentRepo.get
Annex.eval s $ do
Annex.setOutput Types.Messages.QuietOutput
- a
+ a `finally` Annex.Action.stopCoProcesses
innewrepo :: Assertion -> Assertion
innewrepo a = withgitrepo $ \r -> indir r a
@@ -1813,7 +1814,8 @@ intmpclonerepoInDirect a = intmpclonerepo $
checkRepo :: Types.Annex a -> FilePath -> IO a
checkRepo getval d = do
s <- Annex.new =<< Git.Construct.fromPath d
- Annex.eval s getval
+ Annex.eval s $
+ getval `finally` Annex.Action.stopCoProcesses
isInDirect :: FilePath -> IO Bool
isInDirect = checkRepo (not <$> Config.isDirect)