diff options
author | Andre Arko <andre@arko.net> | 2015-05-07 19:59:25 +0100 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-05-07 19:59:25 +0100 |
commit | 73cec1c5b51dd6f9a7d6712ea6832f89ce9cb4f8 (patch) | |
tree | 0da0580d89e184b2c9b44cebfd01558e0d024160 | |
parent | 334e682a74f3a09c8014198763eba10dfb3b2c44 (diff) | |
download | bundler-73cec1c5b51dd6f9a7d6712ea6832f89ce9cb4f8.tar.gz |
preempt possible race in rubygems lock
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 047aa891a6..3bb4cc24a9 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -4,6 +4,11 @@ require 'rubygems/config_file' module Bundler class RubygemsIntegration + if defined?(Gem::Ext::Builder::CHDIR_MONITOR) + EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR + else + EXT_LOCK = Monitor.new + end def self.version @version ||= Gem::Version.new(Gem::VERSION) @@ -149,7 +154,7 @@ module Bundler end def ext_lock - @ext_lock ||= Monitor.new + EXT_LOCK end def fetch_specs(all, pre, &blk) @@ -603,10 +608,6 @@ module Bundler end end - def ext_lock - Gem::Ext::Builder::CHDIR_MONITOR - end - if Gem::Specification.respond_to?(:stubs_for) def find_name(name) Gem::Specification.stubs_for(name).map(&:to_spec) |