diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-09-13 15:01:57 +1000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-09-13 15:01:57 +1000 |
commit | cab5d85dea17f3ea09343955f29eb47c8b32a05d (patch) | |
tree | b69b80b2d57bb03fd6fca899f52e3a91fe5a4d81 /lib/puppet | |
parent | a7306e14b9aa064218d051602715c987aebb8417 (diff) | |
download | puppet-cab5d85dea17f3ea09343955f29eb47c8b32a05d.tar.gz puppet-cab5d85dea17f3ea09343955f29eb47c8b32a05d.tar.xz puppet-cab5d85dea17f3ea09343955f29eb47c8b32a05d.zip |
Fixed #1571 - Puppet::Util::binary returns incorrect results
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/util.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index 94c96db0c..ff9858ed0 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -220,19 +220,14 @@ module Util def binary(bin) if bin =~ /^\// - if FileTest.exists? bin + if FileTest.file? bin and FileTest.executable? bin return bin else return nil end else - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] - x = ENV['PATH'].split(":").each do |dir| - if FileTest.exists? File.join(dir, bin) - return File.join(dir, bin) - end - end - return nil + x = %x{which #{bin} 2>/dev/null}.chomp + return x end end module_function :binary |