summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-30 10:17:46 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-30 10:39:42 +0900
commitf70ba9cf805dc58d993e60fe2bb06d6c5e2f08cb (patch)
tree4b32b3919617639298f5a11a3b96f4cb9ef37bb6
parent58b3a535cc899760aa69055fa54f4fcb85570dcd (diff)
Check for the availability of the command when detecting
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6473
-rw-r--r--tool/lib/vcs.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb
index a08d40742a..d0301b92d8 100644
--- a/tool/lib/vcs.rb
+++ b/tool/lib/vcs.rb
@@ -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)