summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-25 21:08:20 +0900
committerNobuyoshi Nakada <nobu.nakada@gmail.com>2025-10-25 22:42:42 +0900
commitaf8c448129f07faf55248e583a7e5a1b8d55600f (patch)
tree02b6444c612db16f211ec064b6065878ab349703 /test/ruby/test_process.rb
parent377aa2a336cc700485c699ac49330f2a58b74906 (diff)
Add configured environment variables first
And `LD_PRELOAD` is set to `PRELOADENV` on Linux.
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 3bbff73df8..a26712d0e6 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -283,20 +283,18 @@ class TestProcess < Test::Unit::TestCase
end
MANDATORY_ENVS = %w[RUBYLIB GEM_HOME GEM_PATH RUBY_FREE_AT_EXIT]
- case RbConfig::CONFIG['target_os']
- when /linux/
- MANDATORY_ENVS << 'LD_PRELOAD'
- when /mswin|mingw/
- MANDATORY_ENVS.concat(%w[HOME USER TMPDIR PROCESSOR_ARCHITECTURE])
- when /darwin/
- MANDATORY_ENVS.concat(ENV.keys.grep(/\A__CF_/))
- end
if e = RbConfig::CONFIG['LIBPATHENV']
MANDATORY_ENVS << e
end
if e = RbConfig::CONFIG['PRELOADENV'] and !e.empty?
MANDATORY_ENVS << e
end
+ case RbConfig::CONFIG['target_os']
+ when /mswin|mingw/
+ MANDATORY_ENVS.concat(%w[HOME USER TMPDIR PROCESSOR_ARCHITECTURE])
+ when /darwin/
+ MANDATORY_ENVS.concat(ENV.keys.grep(/\A__CF_/))
+ end
PREENVARG = ['-e', "%w[#{MANDATORY_ENVS.join(' ')}].each{|e|ENV.delete(e)}"]
ENVARG = ['-e', 'ENV.each {|k,v| puts "#{k}=#{v}" }']
ENVCOMMAND = [RUBY].concat(PREENVARG).concat(ENVARG)