From 9e121ef985ef6892ac492876fa7345aa92df2f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 8 Oct 2024 17:47:46 +0200 Subject: [PATCH] [rubygems/rubygems] Give `gem install` commands more time https://github.com/rubygems/rubygems/commit/44f3ae4bc8 --- spec/bundler/support/helpers.rb | 6 ++++++ spec/bundler/support/subprocess.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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"