Permalink
Browse files

Avoid calling mkdir with sudo when not needed, you don't want to be a…

…sked for the password
  • Loading branch information...
1 parent 0891a38 commit 5bad31427af192df5ec97ccc69a2e4471bc6cdb0 @spastorino spastorino committed Aug 13, 2010
Showing with 4 additions and 2 deletions.
  1. +1 −1 lib/bundler.rb
  2. +3 −1 lib/bundler/source.rb
View
@@ -199,7 +199,7 @@ def requires_sudo?
def mkdir_p(path)
if requires_sudo?
- sudo "mkdir -p '#{path}'"
+ sudo "mkdir -p '#{path}'" unless File.exist?(path)
else
FileUtils.mkdir_p(path)
end
View
@@ -391,7 +391,9 @@ def initialize(spec, options = {})
def generate_bin
return if spec.executables.nil? || spec.executables.empty?
- FileUtils.mkdir_p("#{Bundler.tmp}/bin") if Bundler.requires_sudo?
+ if Bundler.requires_sudo?
+ FileUtils.mkdir_p("#{Bundler.tmp}/bin") unless File.exist?("#{Bundler.tmp}/bin")
+ end
super
if Bundler.requires_sudo?
Bundler.mkdir_p "#{Gem.dir}/bin"

0 comments on commit 5bad314

Please sign in to comment.