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"