diff options
author | Bundlerbot <bot@bundler.io> | 2019-11-26 23:18:38 +0000 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-12-13 20:07:18 +0100 |
commit | 6d30dcc88e144b63be3c6d00ba7def8967200991 (patch) | |
tree | 9113ad07711c0de52fd3dbc039d2f9d638345f14 | |
parent | a137b11f1b727cfa0d4e3e92c72592181eb8645d (diff) | |
download | bundler-6d30dcc88e144b63be3c6d00ba7def8967200991.tar.gz |
Merge #7455
7455: Lazily load `open3` r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was `open3` will be gemified in ruby 2.7, and since we use it inside `bundler`, we might activate a version causing a conflict with the user's choice.
### What was your diagnosis of the problem?
My diagnosis was that only loading it when needed should be better.
### What is your fix for the problem, implemented in this PR?
My fix is to lazily load it.
I expect this PR to fix [some of the errors](https://travis-ci.org/bundler/bundler/jobs/615940817) currently happening in our CI against ruby-head.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
(cherry picked from commit 2a5378c8c50773b6f8974eb4914894c7c5bd766b)
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 3 | ||||
-rw-r--r-- | spec/support/helpers.rb | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 2a4d7138a4..671610e7c1 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "open3" require "shellwords" module Bundler @@ -243,12 +242,14 @@ module Bundler end def capture_and_filter_stderr(uri, cmd) + require "open3" return_value, captured_err, status = Open3.capture3(cmd) Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty? [return_value, status] end def capture_and_ignore_stderr(cmd) + require "open3" return_value, _, status = Open3.capture3(cmd) [return_value, status] end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index d085b769d7..95c2d60d56 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "open3" - require_relative "command_execution" require_relative "the_bundle" @@ -211,6 +209,7 @@ module Spec env = env.map {|k, v| [k.to_s, v.to_s] }.to_h # convert env keys and values to string + require "open3" Open3.popen3(env, cmd.to_s) do |stdin, stdout, stderr, wait_thr| yield stdin, stdout, wait_thr if block_given? stdin.close |