diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-17 06:54:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-17 06:54:04 +0000 |
commit | d0260aee604b9eaec090c04c27d15e604f5cac28 (patch) | |
tree | 60d30f4befef847537f02807c6d5d8f4ef59e344 /lib/shell | |
parent | 91d28c4ffb253fe64514a543ebb17e9dbeb19374 (diff) | |
download | bundler-d0260aee604b9eaec090c04c27d15e604f5cac28.tar.gz |
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
Diffstat (limited to 'lib/shell')
-rw-r--r-- | lib/shell/command-processor.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb index f52d0ead6d..8a9ab55e73 100644 --- a/lib/shell/command-processor.rb +++ b/lib/shell/command-processor.rb @@ -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 |