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
This commit is contained in:
parent
b824c87117
commit
5245ed6b9f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user