* lib/mkmf.rb (find_executable0): default path if environment is not

set.  [ruby-dev:27281]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-09-22 14:37:02 +00:00
Родитель 759410a8c9
Коммит 4857e1d300
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -1,5 +1,10 @@
Thu Sep 22 23:36:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (find_executable0): default path if environment is not
set. [ruby-dev:27281]
Thu Sep 22 17:31:48 2005 Shugo Maeda <shugo@ruby-lang.org>
* test/readline/test_readline.rb (TestReadline::replace_stdio):
merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223].
(merged from ruby_1_8 branch)

Просмотреть файл

@ -762,8 +762,17 @@ def what_type?(type, member = nil, headers = nil, &b)
end
def find_executable0(bin, path = nil)
path = (path || ENV['PATH']).split(File::PATH_SEPARATOR)
ext = config_string('EXEEXT')
if File.expand_path(bin) == bin
return bin if File.executable?(bin)
return file if ext and File.executable?(file = bin + ext)
return nil
end
if path ||= ENV['PATH']
path = path.split(File::PATH_SEPARATOR)
else
path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
end
file = nil
path.each do |dir|
return file if File.executable?(file = File.join(dir, bin))