diff options
| author | Jack Nagel | 2013-08-09 20:39:17 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-08-10 19:01:50 -0500 |
| commit | 23fbe23426effa91c06fa3c2bcaa5f7c4f828dca (patch) | |
| tree | c9249ad7422c29c9453b711416f44c87bc777ae4 /Library/Homebrew/utils.rb | |
| parent | d5325eb4e4eec11ad31b61c641472a5fb5142ac8 (diff) | |
| download | brew-23fbe23426effa91c06fa3c2bcaa5f7c4f828dca.tar.bz2 | |
Allow specifying a custom PATH for which method
Closes Homebrew/homebrew#21794.
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 818354993..2224e4ed0 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -166,8 +166,8 @@ def puts_columns items, star_items=[] end end -def which cmd - dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)} +def which cmd, path=ENV['PATH'] + dir = path.split(':').find {|p| File.executable? File.join(p, cmd)} Pathname.new(File.join(dir, cmd)) unless dir.nil? end |
