summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2024-10-08 17:47:46 +0200
committergit <svn-admin@ruby-lang.org>2024-10-08 17:48:58 +0000
commit9e121ef985ef6892ac492876fa7345aa92df2f54 (patch)
tree2ea3a17625024b43af2eae835ca29e9e3a59851a
parentcfcc7522d44680b959e08b31c6e3af36fdaaa152 (diff)
[rubygems/rubygems] Give `gem install` commands more time
https://github.com/rubygems/rubygems/commit/44f3ae4bc8
-rw-r--r--spec/bundler/support/helpers.rb6
-rw-r--r--spec/bundler/support/subprocess.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 959720ed05..411d634bbf 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -186,6 +186,12 @@ module Spec
env = options[:env] || {}
env["RUBYOPT"] = opt_add(opt_add("-r#{spec_dir}/support/hax.rb", env["RUBYOPT"]), ENV["RUBYOPT"])
options[:env] = env
+
+ # Sometimes `gem install` commands hang at dns resolution, which has a
+ # default timeout of 60 seconds. When that happens, the timeout for a
+ # command is expired too. So give `gem install` commands a bit more time.
+ options[:timeout] = 120
+
output = sys_exec("#{Path.gem_bin} #{command}", options)
stderr = last_command.stderr
raise stderr if stderr.include?("WARNING") && !allowed_rubygems_warning?(stderr)
diff --git a/spec/bundler/support/subprocess.rb b/spec/bundler/support/subprocess.rb
index ade18e7805..a4842166b9 100644
--- a/spec/bundler/support/subprocess.rb
+++ b/spec/bundler/support/subprocess.rb
@@ -34,7 +34,7 @@ module Spec
dir = options[:dir]
env = options[:env] || {}
- command_execution = CommandExecution.new(cmd.to_s, working_directory: dir, timeout: 60)
+ command_execution = CommandExecution.new(cmd.to_s, working_directory: dir, timeout: options[:timeout] || 60)
require "open3"
require "shellwords"