Skip to content

Commit cfc5018

Browse files
Use vendored timeout from RubyGems
1 parent e2e7440 commit cfc5018

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

Manifest.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ bundler/lib/bundler/vendored_net_http.rb
337337
bundler/lib/bundler/vendored_persistent.rb
338338
bundler/lib/bundler/vendored_pub_grub.rb
339339
bundler/lib/bundler/vendored_thor.rb
340+
bundler/lib/bundler/vendored_timeout.rb
340341
bundler/lib/bundler/vendored_tsort.rb
341342
bundler/lib/bundler/vendored_uri.rb
342343
bundler/lib/bundler/version.rb

Rakefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ if File.exist?("tool/automatiek.rake")
206206
sublib.prefix = "Bundler"
207207
sublib.vendor_lib = "bundler/lib/bundler/vendor/connection_pool"
208208
sublib.license_path = "LICENSE"
209+
210+
sublib.dependency("timeout") do |subsublib|
211+
subsublib.version = "v0.4.1"
212+
subsublib.download = { github: "https://github.com/ruby/timeout" }
213+
subsublib.namespace = "Timeout"
214+
subsublib.prefix = "Gem"
215+
subsublib.vendor_lib = "lib/rubygems/timeout"
216+
subsublib.license_path = "License.txt"
217+
end
209218
end
210219

211220
lib.dependency("uri") do |sublib|

bundler/lib/bundler/fetcher.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require_relative "vendored_persistent"
4+
require_relative "vendored_timeout"
45
require "cgi"
56
require "securerandom"
67
require "zlib"
@@ -287,7 +288,7 @@ def gemspec_cached_path(spec_file_name)
287288
end
288289

289290
HTTP_ERRORS = [
290-
Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
291+
Gem::Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
291292
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
292293
Gem::Net::HTTPBadResponse, Gem::Net::HTTPHeaderSyntaxError, Gem::Net::ProtocolError,
293294
Gem::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH

bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
require "timeout"
1+
require_relative "../../../vendored_timeout"
22
require_relative "connection_pool/version"
33

44
class Bundler::ConnectionPool
55
class Error < ::RuntimeError; end
66

77
class PoolShuttingDownError < ::Bundler::ConnectionPool::Error; end
88

9-
class TimeoutError < ::Timeout::Error; end
9+
class TimeoutError < ::Gem::Timeout::Error; end
1010
end
1111

1212
# Generic connection pool class for sharing a limited number of objects or network connections
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
begin
4+
require "rubygems/timeout"
5+
rescue LoadError
6+
require "timeout"
7+
Gem::Timeout = Timeout
8+
end

0 commit comments

Comments
 (0)