summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2015-08-23 09:49:58 +0900
committerHomu <homu@barosl.com>2015-08-23 09:49:58 +0900
commit1f04cbef33dd12c1a1b04d0c6b3b585ec811632b (patch)
treee163bbdc22337369633146a1c854212910bc029f
parent4b0db7fc591af1c9c5c133507c229800bface545 (diff)
parent7bfd52d0ae67cdfb7735e3dc388395c7bd0824ca (diff)
downloadbundler-1f04cbef33dd12c1a1b04d0c6b3b585ec811632b.tar.gz
Auto merge of #3959 - agis-:issue-3910, r=segiddins
Wrap sudo access prompts in a mutex Fixes #3910.
-rw-r--r--lib/bundler.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 9a46dede49..a299a2adc7 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -1,6 +1,7 @@
require "fileutils"
require "pathname"
require "rbconfig"
+require "thread"
require "bundler/gem_path_manipulation"
require "bundler/rubygems_ext"
require "bundler/rubygems_integration"
@@ -11,6 +12,7 @@ require "bundler/current_ruby"
module Bundler
preserve_gem_path
ORIGINAL_ENV = ENV.to_hash
+ SUDO_MUTEX = Mutex.new
autoload :Definition, "bundler/definition"
autoload :Dependency, "bundler/dependency"
@@ -345,19 +347,21 @@ module Bundler
end
def sudo(str)
- prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
- Your user account isn't allowed to install to the system Rubygems.
- You can cancel this installation and run:
+ SUDO_MUTEX.synchronize do
+ prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
+ Your user account isn't allowed to install to the system Rubygems.
+ You can cancel this installation and run:
- bundle install --path vendor/bundle
+ bundle install --path vendor/bundle
- to install the gems into ./vendor/bundle/, or you can enter your password
- and install the bundled gems to Rubygems using sudo.
+ to install the gems into ./vendor/bundle/, or you can enter your password
+ and install the bundled gems to Rubygems using sudo.
- Password:
- PROMPT
+ Password:
+ PROMPT
- `sudo -p "#{prompt}" #{str}`
+ `sudo -p "#{prompt}" #{str}`
+ end
end
def read_file(file)