Skip to content
Snippets Groups Projects
Commit 21d804ee authored by Martin Afanasjew's avatar Martin Afanasjew Committed by Mike McQuaid
Browse files

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: default avatarMike McQuaid <mike@mikemcquaid.com>
parent b5ec74c3
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment