Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix checking for sudo, and use !(`which foo` rescue '').empty? everyw…

…here
  • Loading branch information...
commit 7585837c2560a46fd8be13d68f2c7e8c79655d3b 1 parent aa17414
@indirect indirect authored
View
2  lib/bundler.rb
@@ -196,7 +196,7 @@ def requires_sudo?
path = bundle_path
path = path.parent until path.exist?
- sudo_present = !(`which sudo 2>&1 >#{NULL}` rescue '').empty?
+ sudo_present = !(`which sudo` rescue '').empty?
@checked_for_sudo = true
@requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present
View
2  lib/bundler/cli.rb
@@ -503,7 +503,7 @@ def self.source_root
private
def have_groff?
- system("which groff 2>&1 >#{NULL}") rescue false
+ !(`which groff` rescue '').empty?
end
def locate_gem(name)
View
2  spec/other/help_spec.rb
@@ -25,7 +25,7 @@
it "simply outputs the txt file when there is no groff on the path" do
kill_path!
- bundle "help install"
+ bundle "help install", :expect_err => true
out.should =~ /BUNDLE-INSTALL/
end
View
2  spec/support/sudo.rb
@@ -1,7 +1,7 @@
module Spec
module Sudo
def self.present?
- @which_sudo ||= `which sudo`.strip rescue ''
+ @which_sudo ||= (`which sudo`.chomp rescue '')
!@which_sudo.empty? && ENV['BUNDLER_SUDO_TESTS']
end
Please sign in to comment.
Something went wrong with that request. Please try again.