summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2023-07-04 18:34:01 +0200
committerHiroshi SHIBATA <[email protected]>2023-12-13 12:16:55 +0900
commitf188a41afee554e46ea2125f22e7d989afc52be0 (patch)
treee7249e62dfd3fedd1912b54266c0b51ae797a0f4
parenta7c9163b5d87c0420e54cd75668bceb8f39a578a (diff)
[rubygems/rubygems] Use vendored timeout from RubyGems
https://github.com/rubygems/rubygems/commit/cfc5018c54
-rw-r--r--lib/bundler/fetcher.rb3
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool.rb4
-rw-r--r--lib/bundler/vendored_timeout.rb8
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index bce762c6d3..c9c8d1b6d6 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require_relative "vendored_persistent"
+require_relative "vendored_timeout"
require "cgi"
require "securerandom"
require "zlib"
@@ -287,7 +288,7 @@ module Bundler
end
HTTP_ERRORS = [
- Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
+ Gem::Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
Gem::Net::HTTPBadResponse, Gem::Net::HTTPHeaderSyntaxError, Gem::Net::ProtocolError,
Gem::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
diff --git a/lib/bundler/vendor/connection_pool/lib/connection_pool.rb b/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
index 455319efe3..ee59d32507 100644
--- a/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
+++ b/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
@@ -1,4 +1,4 @@
-require "timeout"
+require_relative "../../../vendored_timeout"
require_relative "connection_pool/version"
class Bundler::ConnectionPool
@@ -6,7 +6,7 @@ class Bundler::ConnectionPool
class PoolShuttingDownError < ::Bundler::ConnectionPool::Error; end
- class TimeoutError < ::Timeout::Error; end
+ class TimeoutError < ::Gem::Timeout::Error; end
end
# Generic connection pool class for sharing a limited number of objects or network connections
diff --git a/lib/bundler/vendored_timeout.rb b/lib/bundler/vendored_timeout.rb
new file mode 100644
index 0000000000..34770f2116
--- /dev/null
+++ b/lib/bundler/vendored_timeout.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+begin
+ require "rubygems/timeout"
+rescue LoadError
+ require "timeout"
+ Gem::Timeout = Timeout
+end