diff options
author | Andre Arko <andre@arko.net> | 2014-11-17 16:37:24 -0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-11-17 16:37:24 -0800 |
commit | 3185ac97634a994cfe00c41de55f6c9ac2776c8a (patch) | |
tree | 220956788f0282b93ba37165d83935c191982296 | |
parent | 8cbeb529ee12db21c861748fc4a858fd7d27bacc (diff) | |
download | bundler-3185ac97634a994cfe00c41de55f6c9ac2776c8a.tar.gz |
Tentative fix for #3174
This wraps the generation of git gem binstubs in the same exclusive lock
that is used by installing threads. Since generating binstubs _also_
generates the entire gem, it seems like there were install threads
stepping on each other while writing the gem itself and while writing
the gem to add the binstubs.
Ultimately, I think we should stop writing out all the files for each
gem twice, which seems to be what is happening here. It’s more important
to fix the exceptions first, though. :)
-rw-r--r-- | lib/bundler/source/git.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 1f720f530b..de13b8d167 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -219,14 +219,16 @@ module Bundler private def serialize_gemspecs_in(destination) - expanded_path = destination.expand_path(Bundler.root) - Dir["#{expanded_path}/#{@glob}"].each do |spec_path| - # Evaluate gemspecs and cache the result. Gemspecs - # in git might require git or other dependencies. - # The gemspecs we cache should already be evaluated. - spec = Bundler.load_gemspec(spec_path) - next unless spec - File.open(spec_path, 'wb') {|file| file.write(spec.to_ruby) } + SharedHelpers.chdir(destination) do + expanded_path = destination.expand_path(Bundler.root) + Dir["#{expanded_path}/#{@glob}"].each do |spec_path| + # Evaluate gemspecs and cache the result. Gemspecs + # in git might require git or other dependencies. + # The gemspecs we cache should already be evaluated. + spec = Bundler.load_gemspec(spec_path) + next unless spec + File.open(spec_path, 'wb') {|file| file.write(spec.to_ruby) } + end end end |