Skip to content
Browse files

Add and use which helper

/usr/bin/which continues to be deficient on Tiger.
Hopefully fixes #99.
  • Loading branch information...
1 parent c99a6ee commit ec03093c9fc6c44d8450e1feca75187da3c4ad6d @mistydemeo committed Jul 9, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 install
View
7 install
@@ -34,6 +34,11 @@ def system *args
abort "Failed during: #{args.shell_s}" unless Kernel.system *args
end
+def which cmd
+ dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
+ File.join(dir, cmd) unless dir.nil?
+end
+
def sudo *args
args = if args.length > 1
args.unshift "/usr/bin/sudo"
@@ -70,7 +75,7 @@ end
def git
@git ||= if ENV['GIT'] and File.executable? ENV['GIT']
ENV['GIT']
- elsif Kernel.system '/usr/bin/which -s git'
+ elsif which 'git'
'git'
end

0 comments on commit ec03093

Please sign in to comment.
Something went wrong with that request. Please try again.