From 21d804eeb8824e29a152388a7d1483d4dac45640 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Thu, 15 Oct 2015 17:41:07 +0200 Subject: commands: ensure external commands are executable For consistency with `brew command` and the logic in `brew.sh` (both use `which` to find/validate an external command), we need to filter files that are not executable. Otherwise `brew commands` and thus bash completion will offer commands that will produce an error when attempting to use them. Closes Homebrew/homebrew#44999. Signed-off-by: Mike McQuaid --- Library/Homebrew/cmd/commands.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library') diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 30034ec20..d7734e132 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -38,6 +38,7 @@ module Homebrew def external_commands paths.flat_map { |p| Dir["#{p}/brew-*"] }. + select { |f| File.executable?(f) }. map { |f| File.basename(f, ".rb")[5..-1] }. reject { |f| f =~ /\./ }. sort -- cgit v1.2.3