[前][次][番号順一覧][スレッド一覧]

ruby-changes:71198

From: Nobuyoshi <ko1@a...>
Date: Thu, 17 Feb 2022 20:25:21 +0900 (JST)
Subject: [ruby-changes:71198] c8b414b334 (master): Reuse `-v` option result as `target_platform`

https://git.ruby-lang.org/ruby.git/commit/?id=c8b414b334

From c8b414b3345564d975445b25d9bcb9e2604f636d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 17 Feb 2022 20:12:38 +0900
Subject: 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.
---
 bootstraptest/runner.rb | 11 +++++------
 1 file 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, https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L74
                 :reset,
                 :columns,
                 :width,
+                :platform,
                 ).new
 
 BT_STATE = Struct.new(:count, :error).new
@@ -184,6 +185,8 @@ End https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L185
   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 https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L196
     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) https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L337
 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)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]