summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-09-13 11:59:04 -0700
committerJeremy Evans <code@jeremyevans.net>2021-09-14 05:55:14 -0900
commit57d315c937e79199af2b77f21f5eecaca85ffac8 (patch)
tree2cb1f5530720afa596debc33a3d4c4ac10ca422c /test
parent616d6717589abb30a5c67c79cbf874693c3dadbd (diff)
Handle overwriting Object::ENV in spawn
Instead of looking for Object::ENV (which can be overwritten), directly look for the envtbl variable. As that is static in hash.c, and the lookup code is in process.c, add a couple non-static functions that will return envtbl (or envtbl#to_hash). Fixes [Bug #18164]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4834
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_process.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 80d2eefca9..07aa58418b 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -261,6 +261,18 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_overwrite_ENV
+ assert_separately([],"#{<<~"begin;"}\n#{<<~"end;"}")
+ BUG = "[ruby-core:105223] [Bug #18164]"
+ begin;
+ $VERBOSE = nil
+ ENV = {}
+ pid = spawn({}, *#{TRUECOMMAND.inspect})
+ ENV.replace({})
+ assert_kind_of(Integer, pid, BUG)
+ end;
+ end
+
MANDATORY_ENVS = %w[RUBYLIB MJIT_SEARCH_BUILD_DIR]
case RbConfig::CONFIG['target_os']
when /linux/