Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-09-15 09:04:21 +0300
committerJarka Kadlecova <jarka@gitlab.com>2017-09-15 09:04:21 +0300
commit740d158019480f41d0b1e528d0d42c9441d2c2ac (patch)
tree593440a5df388437380869ea2038d13d33f4c8a3 /lib/gitlab/gpg.rb
parent7533bda8a804e6c2d6054eef7a5c3c37c606ea21 (diff)
parentd8bf06926eb67a02bea039261589df5fd2c2fbb6 (diff)
Merge branch '10-0-stable-prepare-rc3' into '10-0-stable'
Prepare 10.0 RC3 release See merge request gitlab-org/gitlab-ce!14266
Diffstat (limited to 'lib/gitlab/gpg.rb')
-rw-r--r--lib/gitlab/gpg.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb
index 025f826e65f..0d5039ddf5f 100644
--- a/lib/gitlab/gpg.rb
+++ b/lib/gitlab/gpg.rb
@@ -69,11 +69,17 @@ module Gitlab
def optimistic_using_tmp_keychain
previous_dir = current_home_dir
- Dir.mktmpdir do |dir|
- GPGME::Engine.home_dir = dir
- yield
- end
+ tmp_dir = Dir.mktmpdir
+ GPGME::Engine.home_dir = tmp_dir
+ yield
ensure
+ # Ignore any errors when removing the tmp directory, as we may run into a
+ # race condition:
+ # The `gpg-agent` agent process may clean up some files as well while
+ # `FileUtils.remove_entry` is iterating the directory and removing all
+ # its contained files and directories recursively, which could raise an
+ # error.
+ FileUtils.remove_entry(tmp_dir, true)
GPGME::Engine.home_dir = previous_dir
end
end