From 9ab2ce20b3197b9f8c6bb8caca508ed6c04f1f5c Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 4 Jun 2012 12:52:35 +0000 Subject: don't exec in the test process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index fb18e97b1f..32d5aee62d 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -304,9 +304,22 @@ class TestProcess < Test::Unit::TestCase end def test_execopts_preserve_env_on_exec_failure - ENV["mgg"] = nil - assert_raise(Errno::ENOENT) { Process.exec({"mgg" => "mggoo"}, "/nonexistent") } - assert_equal(nil, ENV["mgg"], "[ruby-core:44093] [ruby-trunk - Bug #6249]") + with_tmpchdir {|d| + write_file 's', <<-"End" + ENV["mgg"] = nil + prog = "/nonexistent" + begin + Process.exec({"mgg" => "mggoo"}, [prog, prog]) + rescue Errno::ENOENT + end + open('out', 'w') {|f| + f.print ENV["mgg"].inspect + } + End + system(RUBY, 's') + assert_equal(nil.inspect, File.read('out'), + "[ruby-core:44093] [ruby-trunk - Bug #6249]") + } end def test_execopts_env_single_word -- cgit v1.2.3