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

Dir.glob always returns an array

It is not needed to test itself, but the element should be tested
instead.
This commit is contained in:
Nobuyoshi Nakada 2020-04-01 12:37:01 +09:00
parent 57a36a1698
commit 5a81562dfe
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -31,12 +31,8 @@ when /linux/
# In the ARM 32-bit libc package such as libc6:armhf libc6:armel, # In the ARM 32-bit libc package such as libc6:armhf libc6:armel,
# libc.so and libm.so are installed to /lib/arm-linux-gnu*. # libc.so and libm.so are installed to /lib/arm-linux-gnu*.
# It's not installed to /lib32. # It's not installed to /lib32.
dirs = Dir.glob('/lib/arm-linux-gnu*') dir, = Dir.glob('/lib/arm-linux-gnu*')
if dirs.length > 0 libdir = dir if dir && File.directory?(dir)
libdir = dirs[0] if dirs && File.directory?(dirs[0])
else # handle alpine environment
libdir = '/lib' if File.directory? '/lib'
end
else else
libdir = '/lib32' if File.directory? '/lib32' libdir = '/lib32' if File.directory? '/lib32'
end end
@ -46,10 +42,9 @@ when /linux/
end end
# Handle musl libc # Handle musl libc
libc = Dir.glob(File.join(libdir, "libc.musl*.so*")) libc_so, = Dir.glob(File.join(libdir, "libc.musl*.so*"))
if libc && libc.length > 0 if libc_so
libc_so = libc[0] libm_so = libc_so
libm_so = libc[0]
else else
# glibc # glibc
libc_so = File.join(libdir, "libc.so.6") libc_so = File.join(libdir, "libc.so.6")