Check for the availability of the command when detecting

This commit is contained in:
Nobuyoshi Nakada 2022-09-30 10:17:46 +09:00
Родитель 58b3a535cc
Коммит f70ba9cf80
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7CD2805BFA3770C6
1 изменённых файлов: 3 добавлений и 0 удалений

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

@ -69,6 +69,9 @@ class VCS
begin
@@dirs.each do |dir, klass, pred|
if pred ? pred[curr, dir] : File.directory?(File.join(curr, dir))
if klass.const_defined?(:COMMAND)
IO.pread([{'LANG' => 'C', 'LC_ALL' => 'C'}, klass::COMMAND, "--version"]) rescue next
end
vcs = klass.new(curr)
vcs.define_options(parser) if parser
vcs.set_options(options)