Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…sked for the password
  • Loading branch information...
commit 5bad31427af192df5ec97ccc69a2e4471bc6cdb0 1 parent 0891a38
@spastorino spastorino authored
Showing with 4 additions and 2 deletions.
  1. +1 −1  lib/bundler.rb
  2. +3 −1 lib/bundler/source.rb
View
2  lib/bundler.rb
@@ -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
4 lib/bundler/source.rb
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.