summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-03 21:27:03 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-03 21:27:03 +0900
commit52287c68abd696ee7808fa231873e917d74dae7b (patch)
tree7d01184708a8fd7b553644e87f0b7b463c0f55d5
parent5b2ec0eb1be663ff6d3bc12660d48b1e25375353 (diff)
Set Ruby parser if the given ruby accepts `--parser`
Now envutil.rb is a part of test-unit-ruby-core gem, which still supports old versions, 2.3 or later.
-rw-r--r--tool/lib/envutil.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb
index ab5e8d84e9..fef9a0c992 100644
--- a/tool/lib/envutil.rb
+++ b/tool/lib/envutil.rb
@@ -225,7 +225,8 @@ module EnvUtil
args = [args] if args.kind_of?(String)
# use the same parser as current ruby
- if args.none? { |arg| arg.start_with?("--parser=") }
+ if (args.none? { |arg| arg.start_with?("--parser=") } and
+ /^ +--parser=/ =~ IO.popen([rubybin, "--help"], &:read))
args = ["--parser=#{current_parser}"] + args
end
pid = spawn(child_env, *precommand, rubybin, *args, opt)