command-processor.rb: return executable file only

* lib/shell/command-processor.rb (Shell::CommandProcessor#find_system_command):
  return executable file only, should ignore directories and
  unexecutable files.  [ruby-core:57235] [Bug #8918]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-09-17 06:54:04 +00:00
Родитель 91d28c4ffb
Коммит d0260aee60
2 изменённых файлов: 11 добавлений и 2 удалений

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

@ -1,4 +1,8 @@
Tue Sep 17 15:53:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
Tue Sep 17 15:54:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/shell/command-processor.rb (Shell::CommandProcessor#find_system_command):
return executable file only, should ignore directories and
unexecutable files. [ruby-core:57235] [Bug #8918]
* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_throw):
assertion for throw. MiniTest::Assertions#assert_throws discards

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

@ -369,7 +369,12 @@ class Shell
for p in @shell.system_path
path = join(p, command)
if FileTest.exist?(path)
begin
st = File.stat(path)
rescue SystemCallError
next
else
next unless st.executable? and !st.directory?
@system_commands[command] = path
return path
end