1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
parent 91d28c4ffb
commit d0260aee60
2 changed files with 11 additions and 2 deletions

View file

@ -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