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

Check for the availability of the command when detecting

This commit is contained in:
Nobuyoshi Nakada 2022-09-30 10:17:46 +09:00
parent 58b3a535cc
commit f70ba9cf80
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
Notes: git 2022-09-30 12:49:35 +09:00

View file

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