diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-02-17 20:12:38 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-02-17 20:12:38 +0900 |
commit | c8b414b3345564d975445b25d9bcb9e2604f636d (patch) | |
tree | 69745c50c58664cfb80d26070e92f3ed077d8378 | |
parent | dfe7faa6b60464c184fede59f227341f6c57cc97 (diff) | |
download | ruby-c8b414b3345564d975445b25d9bcb9e2604f636d.tar.gz |
Reuse `-v` option result as `target_platform`
Backticks method invokes `/bin/sh` when the command contains
quotes, and `sh` clears some environment variables set in
runruby.rb to search the built shared library.
-rwxr-xr-x | bootstraptest/runner.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index dee9c39ca4..3d42390254 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -74,6 +74,7 @@ BT = Struct.new(:ruby, :reset, :columns, :width, + :platform, ).new BT_STATE = Struct.new(:count, :error).new @@ -184,6 +185,8 @@ End else BT.passed = BT.failed = BT.reset = "" end + target_version = `#{BT.ruby} -v`.chomp + BT.platform = target_version[/\[(.*)\]\z/, 1] unless quiet puts $start_time if defined?(RUBY_DESCRIPTION) @@ -193,7 +196,7 @@ End else puts "Driver is ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]" end - puts "Target is #{`#{BT.ruby} -v`.chomp}" + puts "Target is #{target_version}" puts $stdout.flush end @@ -334,11 +337,7 @@ def exec_test(pathes) end def target_platform - if BT.ruby - `#{BT.ruby} --disable-gems -e 'print RUBY_PLATFORM'` - else - RUBY_PLATFORM - end + BT.platform or RUBY_PLATFORM end class Assertion < Struct.new(:src, :path, :lineno, :proc) |