1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/dtrace/helper.rb: Etc.getgrnam may return nil on some platforms

This commit is contained in:
Yusuke Endoh 2019-10-06 15:22:12 +09:00
parent 2ca353c2e0
commit 6525d3bcc7

View file

@ -19,7 +19,7 @@ if RUBY_PLATFORM =~ /linux/
impl = :stap
begin
require 'etc'
ok = (%w[stapusr stapdev].map {|g|Etc.getgrnam(g).gid} & Process.groups).size == 2
ok = (%w[stapusr stapdev].map {|g|(Etc.getgrnam(g) || raise(ArgumentError)).gid} & Process.groups).size == 2
rescue LoadError, ArgumentError
end unless ok
end