summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-10-18 16:56:38 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-10-18 16:56:38 -0400
commit04015afafab0347f9e852a0ca345f03febf515c2 (patch)
treeec5d6360e27beeb760b68f56dcdb673db8c7e4b6 /Utility
parent87dfb45ab51bc3ce6f49ca0c63bbd761321ea55c (diff)
test: Deal with gpg-agent behavior change that broke the test suite.
gpg-agent started deleting its socket file on shutdown, and this tickled an ugly behavior in removeDirectoryRecursive, https://github.com/haskell/directory/issues/60 Running removeDirectoryRecursive again on exception avoids the problem.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Gpg.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs
index af740c3e0..21171b6fb 100644
--- a/Utility/Gpg.hs
+++ b/Utility/Gpg.hs
@@ -352,7 +352,14 @@ testHarness cmd a = do
[testSecretKey, testKey]
return dir
- cleanup orig tmpdir = removeDirectoryRecursive tmpdir >> reset orig
+ cleanup orig tmpdir = do
+ removeDirectoryRecursive tmpdir
+ -- gpg-agent may be shutting down at the same time
+ -- and may delete its socket at the same time as
+ -- we're trying to, causing an exception. Retrying
+ -- will deal with this race.
+ `catchIO` (\_ -> removeDirectoryRecursive tmpdir)
+ reset orig
reset (Just v) = setEnv var v True
reset _ = unsetEnv var