From 5245ed6b9f7f7bc96b5311e923932e3c7f5af4ea Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 17 Dec 2018 22:48:57 +0000 Subject: Fix test failure if ENV["USER"] doesn't match Process.euid When dropping privileges to run tests, ENV["USER"] could be set to a user that doesn't match Process.euid, which causes this test to fail with Errno::EPERM. Try to get the name for the current euid, and only fallback to ENV["USER"] if that doesn't work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 6f16ac3062..7911a0cb20 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1567,7 +1567,7 @@ class TestProcess < Test::Unit::TestCase end def test_seteuid_name - user = ENV["USER"] or return + user = (Etc.getpwuid(Process.euid).name rescue ENV["USER"]) or return assert_nothing_raised(TypeError) {Process.euid = user} rescue NotImplementedError end -- cgit v1.2.3